/* jaybot.fyi — public profile. Tokens documented in DESIGN.md. */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #efefef;
  --surface-hover: #dbdbdb;
  --text: #0c1014;
  --muted: #6b6f75;
  --border: #dbdbdb;
  --accent: #3346f0;
  --accent-text: #ffffff;
  --ring-a: #3346f0;
  --ring-b: #b13bf5;
  --like: #ff3040;
  --scrim: rgb(0 0 0 / 0.65);
  --elev: 0 8px 32px rgb(12 16 20 / 0.18), 0 2px 6px rgb(12 16 20 / 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --rail: 0px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #25292e;
    --surface-hover: #363a3f;
    --text: #f5f5f5;
    --muted: #a8a8a8;
    --border: #262626;
    --accent: #8b97ff;
    --accent-text: #0a0d2e;
    --elev: 0 8px 32px rgb(0 0 0 / 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #25292e;
  --surface-hover: #363a3f;
  --text: #f5f5f5;
  --muted: #a8a8a8;
  --border: #262626;
  --accent: #8b97ff;
  --accent-text: #0a0d2e;
  --elev: 0 8px 32px rgb(0 0 0 / 0.6);
}

*, *::before, *::after { box-sizing: border-box; }
/* manipulation: no double-tap zoom (a double tap likes a photo, and the heart is often tapped twice). Pinch zoom still works. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
ul { list-style: none; margin: 0; padding: 0; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.i { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- navigation ---------- */

.rail { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 44px; padding: 0 16px; padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; align-items: center; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-avatar {
  width: 0; height: 28px; margin-right: 0; flex: none; border-radius: 50%;
  background: var(--surface) center/cover no-repeat;
  opacity: 0; transform: scale(0.5);
  transition: width 260ms var(--ease), margin 260ms var(--ease), opacity 180ms, transform 260ms var(--ease);
}
body.folded .topbar-avatar { width: 28px; margin-right: 8px; opacity: 1; transform: none; }
.topbar-actions { display: flex; gap: 4px; margin-right: -8px; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; transition: opacity 150ms; }
.icon-btn:active { opacity: 0.5; }

.bottombar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: center;
  height: 50px; padding-bottom: env(safe-area-inset-bottom); box-sizing: content-box;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.bottombar > * { display: grid; place-items: center; flex: 1; height: 100%; }
.bottombar > * { transition: opacity 150ms; }
.bottombar > *:active { opacity: 0.5; }
.bottombar .i { transition: transform 200ms var(--ease); }
.bottombar > *:active .i { transform: scale(0.9); }
.bottombar [aria-current="page"] .i { stroke-width: 2.6; }
.mini-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--surface) center/cover; border: 1px solid var(--border); }

@media (min-width: 768px) {
  :root { --rail: 72px; }
  .topbar, .bottombar { display: none; }
  .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 20;
    display: flex; flex-direction: column;
    width: var(--rail); padding: 8px 12px 20px;
    border-right: 1px solid var(--border);
    background: var(--bg);
  }
  .rail-logo { display: grid; place-items: center; height: 92px; }
  .rail-logo .wordmark { display: none; }
  .rail-items { display: flex; flex-direction: column; gap: 4px; }
  .rail-bottom { margin-top: auto; }
  .rail-item {
    display: flex; align-items: center; gap: 16px;
    width: 100%; height: 48px; padding: 12px; border-radius: 8px;
    transition: background-color 150ms;
  }
  .rail-item span { display: none; font-size: 16px; }
  .rail-item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
  .rail-item:hover .i { transform: scale(1.06); }
  .rail-item .i { transition: transform 200ms var(--ease); }
  .rail-item[aria-current="page"] { font-weight: 700; }
  .rail-item[aria-current="page"] .i { stroke-width: 2.6; }
}
@media (min-width: 1264px) {
  :root { --rail: 244px; }
  .rail-logo { place-items: center start; padding-left: 12px; height: 92px; }
  .rail-logo .wordmark { display: block; font-size: 24px; font-weight: 700; letter-spacing: -0.03em; }
  .rail-logo .rail-mark { display: none; }
  .rail-item span { display: inline; }
}

/* ---------- page ---------- */

.page {
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  /* A tab sliding in (or following a swipe) must never make the page wider than the screen:
     iOS zooms the whole page out for that moment, which reads as a jump. clip keeps sticky working. */
  overflow-x: clip;
}
@media (min-width: 768px) {
  .page { margin-left: var(--rail); padding: 30px 20px 0; }
}

.profile {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  grid-template-areas: "avatar title" "avatar stats" "bio bio" "actions actions";
  column-gap: 20px;
  align-items: center;
  max-width: 935px; margin: 0 auto;
  padding: 16px 16px 0;
}
.avatar {
  grid-area: avatar; width: 86px; height: 86px; border-radius: 50%; align-self: center;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.avatar[aria-disabled="true"] { cursor: default; }
.avatar-ring {
  position: relative; perspective: 500px;
  display: block; width: 100%; height: 100%; border-radius: 50%;
  padding: 3px; background: transparent;
}
.avatar.has-story .avatar-ring { background: linear-gradient(45deg, var(--ring-a), var(--ring-b)); }
.avatar.seen .avatar-ring { background: var(--border); }
.avatar-img {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  background: var(--surface) center/cover no-repeat;
  border: 3px solid var(--bg);
  font-size: 32px; font-weight: 600; color: var(--muted);
  display: grid; place-items: center;
}
.avatar:not(.has-story) .avatar-ring { padding: 0; }
.avatar:not(.has-story) .avatar-img { border: 1px solid var(--border); }

/* Hold the profile photo: it flips over to the bot. */
.avatar-img, .avatar-bot { backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 520ms var(--ease); }
.avatar-bot {
  position: absolute; inset: 3px; border-radius: 50%;
  border: 3px solid var(--bg);
  overflow: hidden; background: var(--bg);
  transform: rotateY(180deg);
}
.avatar:not(.has-story) .avatar-bot { inset: 0; border-width: 1px; border-color: var(--border); }
.avatar.flipped .avatar-img { transform: rotateY(-180deg); }
.avatar.flipped .avatar-bot { transform: rotateY(0deg); }

/* A new story: the ring draws itself once, clockwise from the top. */
@property --ring-sweep { syntax: "<angle>"; inherits: false; initial-value: 360deg; }
.avatar.has-story.ring-draw .avatar-ring {
  background:
    conic-gradient(from 0deg, transparent var(--ring-sweep), var(--border) 0),
    linear-gradient(45deg, var(--ring-a), var(--ring-b));
  animation: ring-draw 1100ms var(--ease) 200ms backwards;
}
@keyframes ring-draw { from { --ring-sweep: 0deg; } }

.title { grid-area: title; align-self: end; min-width: 0; }
.username { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.username .verified { width: 20px; height: 20px; color: var(--accent); }
.display-name { font-size: 15px; font-weight: 600; }
@media (max-width: 767px) {
  /* Phones: the username lives in the top bar, like Instagram. */
  .username { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.stats { grid-area: stats; align-self: start; display: flex; gap: 24px; margin-top: 8px; }
.stats li { display: flex; flex-direction: column; line-height: 1.25; }
.stats b { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 16px; }
.stats span { color: var(--muted); }
.bio-block { grid-area: bio; margin-top: 14px; }
.bio { white-space: pre-line; }
body.loading .display-name:empty,
body.loading .bio:empty { height: 14px; width: 9em; margin: 3px 0; border-radius: 4px; background: var(--surface); animation: pulse 1.4s ease-in-out infinite; }
body.loading .bio:empty { width: min(24em, 80%); height: 32px; }
.bio-links { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.bio-links a { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
.bio-links .i { width: 14px; height: 14px; stroke-width: 2.4; }
.bio-links a:hover { text-decoration: underline; text-underline-offset: 2px; }

@media (min-width: 768px) {
  /* Name and buttons on one row, then stats, then name + bio: Instagram's desktop header. */
  .profile {
    grid-template-columns: 160px auto minmax(0, 1fr);
    grid-template-areas: "avatar title actions" "avatar stats stats" "avatar name name" "avatar bio bio";
    column-gap: 24px; align-items: center; align-content: center; padding: 0 16px;
  }
  .avatar { width: 132px; height: 132px; justify-self: center; grid-row: 1 / 5; }
  .avatar-img { font-size: 48px; }
  .avatar.has-story .avatar-ring { padding: 4px; }
  .avatar.has-story .avatar-bot { inset: 4px; }
  .title { display: contents; }
  .username { grid-area: title; }
  .display-name { grid-area: name; margin: 14px 0 0; font-weight: 600; font-size: 14px; }
  .stats { gap: 36px; margin: 16px 0 0; }
  .stats li { flex-direction: row; gap: 5px; align-items: baseline; }
  .stats b { font-size: 16px; }
  .stats span { color: var(--text); font-size: 16px; }
  .bio-block { align-self: start; margin-top: 2px; }
}
@media (min-width: 1100px) {
  .profile { grid-template-columns: minmax(200px, 290px) auto minmax(0, 1fr); column-gap: 28px; padding: 0; }
  .avatar { width: 150px; height: 150px; }
  .stats { gap: 40px; margin-top: 20px; }
}

.actions { grid-area: actions; display: flex; gap: 8px; margin-top: 16px; }
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 16px; border-radius: 8px;
  background: var(--surface); font-weight: 600;
  transition: background-color 150ms;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { opacity: 0.7; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn .i { width: 16px; height: 16px; stroke-width: 2.2; }
@media (min-width: 768px) {
  .actions { margin: 0; flex-wrap: wrap; }
  .actions .btn { flex: none; height: 34px; padding: 0 16px; font-size: 14px; }
}

/* featured cards */
.featured {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr);
  gap: 10px; overflow-x: auto; scrollbar-width: none;
  max-width: 935px; margin: 16px auto 0; padding: 0 16px;
}
.featured::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .featured { padding: 0; max-width: 706px; } }

.feature-card {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 14px;
  border: 1px solid var(--border);
  transition: background-color 150ms, transform 200ms var(--ease);
}
.feature-card:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.feature-card:active { transform: scale(0.985); }
.feature-thumb {
  width: 52px; height: 52px; flex: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--ring-a), var(--ring-b)) center/cover;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 20px;
}
.feature-text { min-width: 0; flex: 1; }
.feature-text strong { display: block; font-size: 15px; }
.feature-text span { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feature-card .i { width: 18px; height: 18px; color: var(--muted); }

/* highlights */
.highlights { max-width: 935px; margin: 16px auto 0; }
@media (min-width: 1100px) { .highlights-row { padding-inline: 44px; scroll-padding-inline: 44px; } }
.highlights-row {
  display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 16px 8px; scroll-snap-type: x proximity; scroll-padding-inline: 16px;
}
.highlights-row::-webkit-scrollbar { display: none; }
.highlights-row:empty { display: none; }
.hl { flex: none; width: 66px; scroll-snap-align: start; }
.hl button, .hl a { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.hl-ring {
  width: 66px; height: 66px; border-radius: 50%;
  padding: 2px; border: 1px solid var(--border); background: var(--bg);
  transition: transform 200ms var(--ease);
}
.hl button:active .hl-ring { transform: scale(0.94); }
.hl-img { width: 100%; height: 100%; border-radius: 50%; background: var(--surface) center/cover; display: grid; place-items: center; color: var(--muted); }
/* Names up to two lines, centred under the circle, a little wider than it (into the gap) so longer
   names fit without crowding. Anything longer still ends in "…". */
.hl-label {
  width: calc(100% + 16px); margin-inline: -8px; font-size: 12px; font-weight: 600; line-height: 1.2; text-align: center;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  overflow-wrap: anywhere; text-wrap: balance;
}
.hl-label.long { font-size: 11px; letter-spacing: -0.01em; }
@media (min-width: 768px) {
  .highlights { margin-top: 44px; }
  .highlights-row { gap: 30px; padding: 4px 16px 8px; scroll-padding-inline: 16px; }
  .hl { width: 87px; }
  .hl-ring { width: 87px; height: 87px; padding: 4px; }
}

/* tabs */
.tabs {
  position: relative;
  display: flex; justify-content: center;
  max-width: 935px; margin: 12px auto 0;
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 46px; color: var(--muted);
  border-top: 1px solid transparent; margin-top: -1px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.tab span { display: none; }
.tab { transition: color 150ms, border-color 200ms; }
.tab:active .i { transform: scale(0.92); }
.tab .i { transition: transform 150ms var(--ease); }
.tab[aria-selected="true"] { color: var(--text); }
.tab-ind { position: absolute; top: -1px; left: 0; width: 0; height: 1px; background: var(--text); pointer-events: none; }
.tab-ind.glide { transition: transform 320ms var(--ease), width 320ms var(--ease); }
@media (max-width: 767px) {
  .tabs { position: sticky; top: calc(45px + env(safe-area-inset-top)); z-index: 15; background: var(--bg); }
  .tabs-anchor { scroll-margin-top: calc(45px + env(safe-area-inset-top)); }
}
.tab .i { width: 22px; height: 22px; }
@media (min-width: 768px) {
  .tabs { margin-top: 44px; gap: 60px; max-width: 935px; }
  .tab { flex: none; height: 52px; }
  .tab span { display: inline; }
  .tab .i { width: 14px; height: 14px; stroke-width: 2.4; }
}

/* ---------- grid ---------- */

.panel { max-width: 1380px; margin: 0 auto; }
/* On phones a short tab (or one still loading) must not shrink the page, or the browser clamps the scroll and the whole screen jumps when you switch tabs. */
@media (max-width: 767px) { .panel { min-height: 100svh; } }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; grid-auto-flow: row dense; }
/* A highlighted post: twice as big (2 x 2) wherever it falls; smaller posts fill in around it. */
.grid > li.big:not(:only-child) { grid-column: span 2; grid-row: span 2; }
@media (min-width: 768px) { .grid { gap: 4px; max-width: 935px; margin: 0 auto; } }
.grid > li { position: relative; }
/* First load: photos settle in one after another. */
.grid > li.enter { animation: tile-in 520ms var(--ease) backwards; }
@keyframes tile-in { from { opacity: 0; transform: scale(0.96); } }
.tile { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; background: var(--surface); }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: opacity 300ms; }
.tile img[data-loading] { opacity: 0; }
.tile img.crop { position: absolute; max-width: none; }
/* The blurred preview under a photo while it loads. */
.tile[style*="--blur"]::before, .pf-item[style*="--blur"]::before {
  content: ""; position: absolute; inset: -12px;
  background: var(--blur) center / cover no-repeat;
  filter: blur(12px);
}
.tile img, .pf-item img { position: relative; }
.tile-badge {
  position: absolute; top: 8px; right: 8px; color: #fff; display: flex; gap: 4px;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.5));
}
.tile-badge .i { width: 20px; height: 20px; }
.tile-badge .i.fill { fill: #fff; stroke: #fff; }
.tile-hover {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 24px;
  background: rgb(0 0 0 / 0.32); color: #fff; font-weight: 700; font-size: 16px;
  opacity: 0; transition: opacity 150ms;
}
.tile-hover span { display: inline-flex; align-items: center; gap: 6px; }
.tile-hover .i { width: 20px; height: 20px; fill: #fff; stroke: #fff; }
@media (hover: hover) {
  .tile:hover .tile-hover, .tile:focus-visible .tile-hover { opacity: 1; }
}
.tile:focus-visible { outline-offset: -3px; border-radius: 0; }
.tile::after { content: ""; position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 120ms; pointer-events: none; }
.tile:active::after { opacity: 0.12; }
.grid .retry { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; padding-bottom: 48px; }
.grid .retry .empty { padding-bottom: 8px; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 64px 24px; text-align: center;
}
.empty-icon { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--text); display: grid; place-items: center; }
.bot-face { display: block; width: 112px; height: 112px; flex: none; }
/* The bots draw with some air around them; trim it so they read bigger in their spot. */
.bot-face .jbot, .rail-mark .jbot, .avatar-bot .jbot { overflow: visible; transform: scale(1.18); }
.bot-avatar .jbot { overflow: visible; transform: scale(1.32); }
/* The jaybots (public/bots.js) only animate while someone can see them. */
.bot-face:not(.awake) .jbot *, .avatar:not(.flipped) .avatar-bot .jbot * { animation-play-state: paused; }
.bot-avatar { overflow: visible; background: none; border: 0; }
.rail-mark { display: block; width: 36px; height: 36px; }
.caught-up { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 24px 0; text-align: center; }
.caught-up h2 { margin: 6px 0 0; font-size: 17px; font-weight: 700; }
.caught-up p { color: var(--muted); }
.lost {
  display: flex; align-items: center; gap: 12px;
  max-width: 935px; margin: 12px auto; padding: 12px 8px 12px 12px;
  border: 1px solid var(--border); border-radius: 14px;
}
.lost .bot-face { width: 60px; height: 60px; }
.lost div { flex: 1; display: flex; flex-direction: column; }
.lost span { color: var(--muted); }
.lost-x { display: grid; place-items: center; width: 44px; height: 44px; color: var(--muted); }
.lost-x .i { width: 18px; height: 18px; }
@media (max-width: 767px) { .lost { margin: 12px 16px; } }
.empty-icon .i { width: 30px; height: 30px; stroke-width: 1.6; }
.empty h2 { margin: 8px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.empty p { color: var(--muted); max-width: 36ch; }
.empty .btn { flex: none; margin-top: 8px; }
.sentinel { height: 1px; }

.grid .skel-tile { aspect-ratio: 3 / 4; background: var(--surface); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.skel { color: transparent; background: var(--surface); border-radius: 4px; }

/* Link posts: a round button in the corner that goes straight to the site. */
.tile-out {
  position: absolute; right: 5px; bottom: 5px; z-index: 2;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: rgb(0 0 0 / 0.5); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background-color 150ms, transform 150ms var(--ease);
}
.tile-out:hover { background: rgb(0 0 0 / 0.72); }
.tile-out:active { transform: scale(0.9); }
.tile-out .i { width: 14px; height: 14px; stroke-width: 2.4; }

/* Signed in: a ⋯ button in the corner of each grid photo with Edit and Delete. Shows on hover with a mouse,
   always on touch screens. */
.tile-more {
  position: absolute; right: 6px; bottom: 6px; z-index: 3;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: rgb(0 0 0 / 0.5); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: opacity 150ms, background-color 150ms, transform 150ms var(--ease);
}
.tile-more svg { width: 16px; height: 16px; fill: currentColor; }
.tile-more:hover, .tile-more.open { background: rgb(0 0 0 / 0.75); }
.tile-more:active { transform: scale(0.9); }
.grid > li:has(.tile-more) .tile-out { right: 42px; }
@media (hover: none) {
  .tile-more { display: none; }
  .grid > li:has(.tile-more) .tile-out { right: 5px; }
}
.peek-menu .danger { color: var(--like, #e0245e); }
@media (hover: hover) {
  .tile-more { opacity: 0; }
  .grid > li:hover .tile-more, .tile-more:focus-visible, .tile-more.open { opacity: 1; }
}
.tile-menu {
  position: fixed; z-index: 60; min-width: 180px; max-width: 240px; padding: 6px;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.18); animation: tile-menu-in 140ms var(--ease);
}
@keyframes tile-menu-in { from { opacity: 0; transform: translateY(4px) scale(0.97); } }
.tile-menu a, .tile-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px;
  font: inherit; font-size: 14px; font-weight: 600; color: inherit; text-align: left; text-decoration: none;
}
.tile-menu a:hover, .tile-menu button:hover, .tile-menu :focus-visible { background: var(--surface); outline: none; }
.tile-menu .i { width: 17px; height: 17px; }
.tile-menu .danger { color: var(--like, #e0245e); }
.tile-menu p { margin: 4px 10px 6px; font-size: 13px; line-height: 1.4; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .tile-menu { animation: none; } }

/* ---------- words tab (Journal) ---------- */

.words {
  --serif: "New York", "Iowan Old Style", Charter, Georgia, serif;
  --year-top: calc(45px + 45px + env(safe-area-inset-top));
  display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; padding: 4px 16px 32px;
}
.jr-year + .jr-year { margin-top: 10px; border-top: 1px solid var(--border); }
.jr-y {
  position: sticky; top: var(--year-top); z-index: 2; margin: 0; padding: 14px 0 8px; background: var(--bg);
  display: flex; align-items: baseline; gap: 10px;
  font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1;
}
.jr-y small { font-family: var(--font); font-size: 12px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.jr-entry {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 0 18px;
  transition: opacity 150ms;
}
.jr-entry + .jr-entry { padding-top: 16px; border-top: 1px dashed var(--border); }
.jr-entry:active { opacity: 0.7; }
.jr-day { padding-top: 3px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.jr-day b { display: block; margin-top: 2px; font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; color: var(--text); }
.jr-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.jr-text strong { font-family: var(--font); font-size: 17px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; text-wrap: pretty; }
@media (hover: hover) { .jr-entry:hover strong { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; } }
.word-sub { color: var(--muted); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.jr-print {
  width: 78px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 8px; border: 3px solid var(--bg); background: var(--surface);
  transform: rotate(var(--r, 1.5deg)); box-shadow: 0 6px 18px rgb(0 0 0 / 0.14);
  transition: transform 300ms var(--ease);
}
@media (hover: hover) { .jr-entry:hover .jr-print { transform: rotate(0deg) scale(1.03); } }
.skel-word { height: 96px; border: 0; margin: 10px 0; border-radius: 10px; background: var(--surface); animation: pulse 1.4s ease-in-out infinite; }
.words-more { margin-top: 24px; }
.words-retry { display: flex; justify-content: center; }

@media (min-width: 768px) {
  .words { --year-top: 0px; padding: 16px 24px 40px; }
  .jr-year { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 28px; padding-top: 22px; }
  .jr-year + .jr-year { margin-top: 18px; }
  .jr-y { flex-direction: column; align-items: flex-start; gap: 6px; align-self: start; padding: 0; font-size: 44px; background: none; }
  .jr-entry { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 20px; padding: 4px 0 26px; }
  .jr-entry + .jr-entry { padding-top: 22px; }
  .jr-day b { font-size: 30px; }
  .jr-text strong { font-size: 21px; line-height: 1.2; }
  .word-sub { font-size: 15px; -webkit-line-clamp: 3; }
  .jr-print { width: 132px; border-width: 4px; border-radius: 10px; }
  .words > .words-more { align-self: center; padding: 12px 52px; }
}

/* ---------- links tab ---------- */

.links { display: flex; flex-direction: column; gap: 10px; max-width: 580px; margin: 0 auto; padding: 20px 16px 32px; }
.links .feature-card { padding: 14px; }
.links .feature-thumb { width: 64px; height: 64px; border-radius: 14px; }
.link-btn {
  display: flex; align-items: center; justify-content: center; position: relative;
  min-height: 56px; padding: 12px 48px; border-radius: 14px;
  background: var(--surface); font-weight: 600; font-size: 15px; text-align: center;
  transition: background-color 150ms, transform 200ms var(--ease);
}
.link-btn:hover { background: var(--surface-hover); }
.link-btn:active { transform: scale(0.985); }
.link-btn .i { position: absolute; right: 18px; width: 18px; height: 18px; color: var(--muted); }
.links-label { margin: 14px 2px 0; color: var(--muted); font-size: 13px; font-weight: 600; }

.foot { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 16px 12px; color: var(--muted); font-size: 12px; }
.foot a { color: inherit; }
.foot-sub { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 20px; background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; }
.foot-sub .i { width: 18px; height: 18px; }
.sub-dialog { border: 0; border-radius: 18px; padding: 0; width: min(380px, calc(100vw - 32px)); background: var(--bg); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / 0.3); }
.sub-dialog::backdrop { background: rgb(0 0 0 / 0.5); }
.sub-form { display: flex; flex-direction: column; gap: 10px; padding: 24px 20px 20px; text-align: center; }
.sub-form h2 { margin: 0; font-size: 19px; }
.sub-form p { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.sub-form input[type=email] { padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.sub-form input[type=email]:focus { outline: none; border-color: var(--accent); }
.sub-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.sub-msg:empty { display: none; }
.sub-msg { color: var(--like) !important; }
.sub-form .btn { width: 100%; min-height: 44px; justify-content: center; }

/* ---------- post dialog ---------- */

.post-dialog {
  --dh: min(92vh, 92dvh, 880px);
  padding: 0; border: 0; margin: 0;
  width: 100%; height: 100%; max-width: none; max-height: none;
  background: var(--bg); color: var(--text);
  overflow: hidden;
}
.post-dialog::backdrop { background: var(--scrim); }
/* Phone keyboard up: the dialog fills only the visible part of the screen (set from app.js). */
.post-dialog.kb { position: fixed; inset: var(--vvt, 0) 0 auto 0; height: var(--vvh, 100%); }
.post-dialog.kb .comment-form { padding-bottom: 10px; z-index: 6; }
.post-dialog[open] { animation: soft-in 240ms var(--ease); }
/* Opening from a tile: the photo grows out of the grid; the rest fades in around it. */
.post-dialog.morph[open] { animation: bg-in 260ms ease-out; }
.post-dialog.morph #post > :not(.post-media), .post-dialog.morph > :not(#post) { animation: fade 240ms 90ms ease-out backwards; }
.post-dialog.morphing, .post-dialog.morphing #post { overflow: visible; }
.post-dialog.morph-out { animation: bg-out 280ms ease-in forwards; }
.post-dialog.morph-out::backdrop { animation: fade-out 280ms ease-in forwards; }
.post-dialog.morph-out #post > :not(.post-media), .post-dialog.morph-out > :not(#post) { animation: fade-out 140ms ease-in forwards; }
@keyframes bg-in { from { background-color: transparent; box-shadow: none; } }
@keyframes bg-out { to { background-color: transparent; box-shadow: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes soft-in { from { opacity: 0; transform: scale(0.985); } }
.post-dialog::backdrop { animation: fade 200ms ease-out; }
@keyframes fade { from { opacity: 0; } }
.post-dialog.leaving { animation: sink 200ms ease-in forwards; }
.post-dialog.leaving::backdrop { animation: fade-out 200ms ease-in forwards; }
@keyframes sink { to { opacity: 0; transform: translateY(12px); } }
@keyframes fade-out { to { opacity: 0; } }

.dialog-close {
  position: absolute; z-index: 5; top: calc(6px + env(safe-area-inset-top)); left: 6px;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
}
.post-nav { display: none; }

.post {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "media" "actions" "thread" "form";
  grid-template-rows: auto auto auto auto auto;
  align-content: start;
  padding-top: env(safe-area-inset-top);
}
.post-head {
  grid-area: head; display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 16px 0 56px;
  border-bottom: 1px solid var(--border);
}
.post-head .mini-avatar { width: 32px; height: 32px; flex: none; }
.post-head strong { font-weight: 600; }
.post-head .pin-note { margin-left: auto; color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.post-head .pin-note .i { width: 14px; height: 14px; }

.post-media { grid-area: media; position: relative; background: #000; }
.carousel {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  width: 100%; /* without it a max-height squeezes the width too, leaving a black bar beside tall photos */
  aspect-ratio: var(--ar, 0.75);
  max-height: 85vh;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel img { flex: none; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; user-select: none; -webkit-user-drag: none; background: center / cover no-repeat; } /* photos fill the frame (cropped), never letterboxed; the expand button shows the whole photo */
.carousel video { flex: none; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; background: #000; }
/* Video controls drawn by the site (no browser controls): a sound button, a play mark while paused,
   and a thin progress line along the bottom. Taps go through to the video except on the button. */
.vid-ui { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.vid-ui[hidden] { display: none; }
.vid-sound {
  position: absolute; right: 12px; bottom: 14px; pointer-events: auto;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: rgb(0 0 0 / 0.5); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: transform 150ms var(--ease), background-color 150ms;
}
.vid-sound:active { transform: scale(0.9); }
.vid-sound .i { width: 16px; height: 16px; stroke-width: 2.2; }
.post-media:has(.link-sticker) .vid-sound { bottom: 58px; }
.vid-paused {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: rgb(0 0 0 / 0.4); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; scale: 1.15; transition: opacity 180ms ease-out, scale 220ms var(--ease);
}
.vid-paused .i { width: 26px; height: 26px; margin-left: 3px; fill: currentColor; stroke: none; }
.vid-ui.held .vid-paused { opacity: 1; scale: 1; }
.vid-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgb(255 255 255 / 0.22); overflow: hidden; }
.vid-bar i { position: absolute; inset: 0; background: rgb(255 255 255 / 0.9); transform-origin: left; transform: scaleX(0); }
@media (prefers-reduced-motion: reduce) { .vid-paused { transition: none; } }
@media (max-width: 767px), (max-width: 1099px) and (orientation: portrait) {
  /* Leave room for the like row and comment box under the photo. */
  .carousel { max-height: calc(100svh - 230px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
}
.car-btn::before { content: ""; position: absolute; inset: -8px; }
.car-btn {
  position: absolute; top: 50%; translate: 0 -50%;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: rgb(255 255 255 / 0.85); color: #000;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.25);
}
.car-btn .i { width: 18px; height: 18px; stroke-width: 2.6; }
.car-btn.prev { left: 10px; }
.car-btn.next { right: 10px; }
.car-btn:disabled { opacity: 0; pointer-events: none; }
/* Touch screens swipe through photos, so no arrows. */
@media (hover: none) { .car-btn, .post-nav { display: none !important; } }
#post:focus { outline: none; }
.dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; pointer-events: none; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: rgb(255 255 255 / 0.45); transition: background-color 200ms; }
.dots span.on { background: #fff; }
.burst {
  position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; translate: -50% -50%;
  color: #fff; fill: #fff; stroke: none; pointer-events: none;
  filter: drop-shadow(0 4px 16px rgb(0 0 0 / 0.35));
  animation: burst 900ms var(--ease) forwards;
}
@keyframes burst {
  0% { opacity: 0; scale: 0.2; }
  15% { opacity: 1; scale: 1.15; }
  30% { scale: 0.95; }
  45%, 70% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: 0.6; translate: -50% -80%; }
}

.spark {
  position: absolute; left: 50%; top: 50%; z-index: 4; width: 9px; height: 9px; margin: -4.5px;
  border-radius: 50%; pointer-events: none;
  animation: spark 700ms var(--ease) 80ms both;
}
@keyframes spark {
  0% { transform: scale(0.3); opacity: 0; }
  10% { opacity: 1; }
  45% { transform: translate(calc(var(--x) * 0.85), calc(var(--y) * 0.85)) scale(1); opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) scale(0.3); opacity: 0; }
}

.post-actions { grid-area: actions; padding: 6px 12px 10px; }
.post-actions .row { display: flex; align-items: center; gap: 4px; margin-left: -4px; }
.post-actions .row .share { margin-left: auto; }
.act { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; transition: color 150ms; }
.act:hover { color: var(--muted); }
.act:active .i { transform: scale(0.88); }
.act .i { transition: transform 150ms var(--ease); }
.act .i { width: 26px; height: 26px; }
.act.liked .i { fill: var(--like); stroke: var(--like); animation: pop 400ms var(--ease); }
@keyframes pop { 40% { scale: 1.25; } }
.likes { font-weight: 600; padding: 0 4px; font-variant-numeric: tabular-nums; }
.when { color: var(--muted); font-size: 12px; padding: 4px 4px 0; }

.post-thread { grid-area: thread; padding: 4px 16px 12px; display: flex; flex-direction: column; gap: 14px; }
.cmt { display: flex; gap: 12px; }
.cmt .mini-avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); object-fit: cover; }
.cmt-body { min-width: 0; overflow-wrap: anywhere; }
.cmt-body strong { font-weight: 600; margin-right: 6px; }
.cmt-body p { display: inline; white-space: pre-line; }
.cmt-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.cmt-group { display: flex; flex-direction: column; gap: 12px; }
.cmt-replies { display: flex; flex-direction: column; gap: 12px; margin-left: 44px; }
.cmt-replies:empty { display: none; }
.cmt-replies .cmt .mini-avatar { width: 24px; height: 24px; }
.replying {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between;
  margin: -2px 0 2px; color: var(--muted); font-size: 12px;
}
.replying button { display: grid; place-items: center; width: 28px; height: 28px; min-height: 0; padding: 0; color: var(--muted); }
.replying .i { width: 14px; height: 14px; }
.owner-name { display: inline-flex; align-items: center; gap: 3px; }
.owner-badge { width: 14px; height: 14px; color: var(--accent); }
.reply-btn { color: var(--muted); font-weight: 600; font-size: 12px; padding: 0; }
.reply-btn:hover { color: var(--text); }
/* Link posts: a small sticker on the photo (bottom-right) and a compact row under it. */
.link-sticker {
  position: absolute; right: 10px; bottom: 10px; z-index: 3;
  display: inline-flex; align-items: center; gap: 5px; max-width: 46%;
  height: 26px; padding: 0 8px 0 3px; border-radius: 999px;
  background: rgb(255 255 255 / 0.92); color: #111; font-size: 12px; font-weight: 600;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 1px 6px rgb(0 0 0 / 0.22);
  transition: transform 150ms var(--ease), background-color 150ms;
}
.link-sticker:hover { background: #fff; }
.link-sticker:active { transform: scale(0.94); }
.link-sticker > .i { width: 12px; height: 12px; stroke-width: 2.4; flex: none; }
.ls-site { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ls-thumb, .lr-thumb {
  position: relative; flex: none; display: grid; place-items: center; overflow: hidden;
  background: #ececec; color: #666;
}
.ls-thumb { width: 20px; height: 20px; border-radius: 50%; }
.ls-thumb .i { width: 11px; height: 11px; }
.ls-thumb img, .lr-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.link-row {
  display: flex; align-items: center; gap: 10px; margin: 8px 4px 4px; padding: 6px 12px 6px 6px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg); min-width: 0;
  transition: background-color 150ms, transform 200ms var(--ease);
}
.link-row:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.link-row:active { transform: scale(0.99); }
.link-slot.in-actions { display: none; }
.link-slot.in-thread .link-row { margin: -4px 0 0; }
.link-row.is-loading { opacity: 0.7; }
.link-row > .i { width: 16px; height: 16px; flex: none; color: var(--muted); }
.lr-thumb { width: 40px; height: 40px; border-radius: 8px; background: var(--surface); color: var(--muted); }
.lr-thumb .i { width: 18px; height: 18px; }
.lr-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.lr-site { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-text strong { font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-desc { display: none; }
/* Computers: more room, so the preview grows into a small card (bigger image, two-line title, the page's description). */
@media (min-width: 1000px) {
  .link-row { gap: 14px; padding: 8px 14px 8px 8px; border-radius: 14px; }
  .lr-thumb { width: 76px; height: 76px; border-radius: 10px; }
  .lr-thumb .i { width: 24px; height: 24px; }
  .lr-text { gap: 3px; }
  .lr-site { font-size: 12.5px; }
  .lr-text strong { font-size: 15px; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .lr-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.35; }
  .link-row > .i { width: 18px; height: 18px; align-self: flex-start; margin-top: 4px; }
  .link-sticker { height: 32px; gap: 7px; padding: 0 11px 0 4px; font-size: 13.5px; right: 14px; bottom: 14px; }
  .link-sticker .ls-thumb { width: 24px; height: 24px; }
  .link-sticker > .i { width: 13px; height: 13px; }
}
.no-comments { color: var(--muted); text-align: center; padding: 16px 0; }
.cmt.fresh { animation: rise 320ms var(--ease); }

.comment-form {
  grid-area: form;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg);
  position: sticky; bottom: 0;
}
.comment-form .fields { display: flex; flex-direction: column; gap: 6px; }
.comment-form input, .comment-form textarea {
  width: 100%; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; padding: 6px 0; resize: none; outline: none;
}
.comment-form input { font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--border); }
.comment-form textarea { min-height: 24px; max-height: 120px; }
.comment-form input::placeholder, .comment-form textarea::placeholder { color: var(--muted); font-weight: 400; }
.comment-form:not(.composing) input[name="name"], .comment-form:not(.composing) .who { display: none; }
/* Name row: the commenter's character (tap to pick one) next to their name. */
.who { display: flex; align-items: center; gap: 8px; }
.who input[name="name"] { flex: 1; min-width: 0; }
.comment-form .face-pick {
  position: relative; display: grid; place-items: center; flex: none;
  min-height: 0; padding: 0; width: 40px; height: 36px; color: var(--muted);
}
.face-pick .face-now { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; overflow: hidden; }
.face-caret { position: absolute; right: -2px; bottom: 0; display: grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); box-shadow: 0 0 0 1px var(--border); }
.face-caret .i { width: 10px; height: 10px; stroke-width: 2.6; }
.face-menu {
  position: absolute; z-index: 6; left: 8px; right: 8px; bottom: calc(100% - 4px);
  max-height: min(360px, 55vh); overflow-y: auto; overscroll-behavior: contain;
  padding: 12px; border-radius: 14px; background: var(--bg); box-shadow: var(--elev), 0 0 0 1px var(--border);
  animation: rise 200ms var(--ease);
}
.comment-form:has(.face-menu) { z-index: 20; }
.face-menu-title { margin: 0 0 8px; font-weight: 600; font-size: 14px; }
.face-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.comment-form .face-opts button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-height: 0; padding: 8px 4px; border-radius: 10px; color: var(--text); font-weight: 400; font-size: 12px;
}
.face-opts button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.face-opts button:hover { background: var(--surface); }
.face-opts button[aria-selected="true"] { background: var(--surface); font-weight: 600; }
.face-opts button[aria-selected="true"] .face-opt-img { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.face-opt-img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; overflow: hidden; }
.comment-form.composing .fields { animation: fade 180ms ease-out; }
.comment-form button { color: var(--accent); font-weight: 600; min-height: 44px; padding: 8px 4px; transition: opacity 150ms; }
.comment-form button:disabled { opacity: 0.4; cursor: default; }
.comment-form.busy button span { animation: pulse 1s ease-in-out infinite; }
.comment-form .err { grid-column: 1 / -1; color: var(--like); font-size: 12px; }
.comment-form .closed { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 6px 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* iPad held upright (and narrow windows): the post fills the screen, photo on top, in a centered column. */
@media (min-width: 768px) and (max-width: 1099px) and (orientation: portrait) {
  .post { max-width: 680px; margin: 0 auto; border-inline: 1px solid var(--border); }
  .post-head { padding-left: 16px; }
  .dialog-close { left: 12px; top: calc(12px + env(safe-area-inset-top)); }
}

/* Side by side (photo left, comments right): iPad sideways and computers. Matches SIDE_MQ in app.js. */
@media (min-width: 1100px), (min-width: 768px) and (orientation: landscape) {
  .link-slot.in-thread { display: none; }
  .link-slot.in-actions { display: block; }
  .post-dialog {
    --gut: 160px; --side: 380px;
    width: fit-content; height: auto; max-width: calc(100vw - var(--gut)); max-height: var(--dh);
    margin: auto; border-radius: 4px; overflow: visible;
    box-shadow: var(--elev);
  }
  .post-dialog[open] { display: block; }
  .dialog-close { position: fixed; top: 10px; right: 10px; left: auto; color: #fff; }
  .post-nav {
    position: fixed; top: 50%; translate: 0 -50%;
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
    background: rgb(255 255 255 / 0.9); color: #000;
  }
  .post-nav.prev { left: 24px; }
  .post-nav.next { right: 24px; }
  .post-nav:disabled { display: none; }
  .post {
    height: var(--dh); overflow: hidden;
    grid-template-columns: min(calc(var(--dh) * var(--ar, 0.75)), calc(100vw - var(--gut) - var(--side))) var(--side);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "media head" "media thread" "media actions" "media form";
    padding: 0;
  }
  .post-media { height: var(--dh); border-radius: 4px 0 0 4px; overflow: hidden; }
  .carousel { height: 100%; aspect-ratio: auto; max-height: none; }
  .post-head { padding: 0 16px; height: 60px; }
  .post-thread { overflow-y: auto; padding: 16px; border-bottom: 1px solid var(--border); }
  .post-actions { padding: 6px 12px 12px; }
  .comment-form { position: relative; padding-bottom: 12px; }
}
/* Touch screens get more of the width for the photo; narrower screens a slimmer comments column. */
@media (min-width: 768px) and (orientation: landscape) and (hover: none) { .post-dialog { --gut: 120px; } }
@media (min-width: 768px) and (max-width: 1180px) and (orientation: landscape) { .post-dialog { --side: 340px; } }

/* ---------- story viewer ---------- */

.story {
  position: fixed; inset: 0; z-index: 50;
  background: rgb(17 17 17 / calc(1 - var(--drag, 0) * 0.7)); color: #fff;
  display: grid; place-items: center;
  touch-action: none;
  transform-origin: var(--ox, 50%) var(--oy, 50%);
  animation: story-in 340ms var(--ease);
}
/* Grows out of the tapped circle, shrinks back into it. */
@keyframes story-in { from { opacity: 0; transform: scale(0.2); border-radius: 50%; } }
.story.leaving { animation: story-out 240ms cubic-bezier(0.4, 0, 1, 1) forwards; }
@keyframes story-out { to { opacity: 0; transform: scale(0.2); } }
.story-frame { transition: transform 280ms var(--ease); }
.story-media img, .story-media video { opacity: 0; transition: opacity 240ms ease-out; }
.story-media img.shown, .story-media video.shown { opacity: 1; }
.story-top, .story-caption, .story-side { transition: opacity 200ms; }
.story.held .story-top, .story.held .story-caption, .story.held .story-side { opacity: 0; }
.story.waiting .story-frame::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 32px; height: 32px; margin: -16px;
  border-radius: 50%; border: 3px solid rgb(255 255 255 / 0.25); border-top-color: #fff;
  animation: spin 800ms linear infinite, fade 200ms 300ms both;
}
@keyframes spin { to { rotate: 360deg; } }
.story-frame {
  position: relative; width: 100%; height: 100%;
  background: #000; overflow: hidden;
}
@media (min-width: 768px) {
  .story-frame { width: auto; height: min(92vh, 900px); aspect-ratio: 9 / 16; border-radius: 10px; }
}
.story-frame img { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.story-frame img.cover { object-fit: cover; }
.story-frame video { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; object-fit: contain; background: #000; }
.story-frame video.cover { object-fit: cover; }
.story-who .story-sound { margin-left: auto; display: grid; place-items: center; width: 44px; height: 44px; color: #fff; }
.story-who .story-sound:not([hidden]) + .story-close { margin-left: 0; }
.story-top {
  position: absolute; inset: 0 0 auto 0; z-index: 2;
  padding: calc(8px + env(safe-area-inset-top)) 10px 28px;
  background: linear-gradient(rgb(0 0 0 / 0.45), transparent);
}
.bars { display: flex; gap: 3px; }
.bars span { flex: 1; height: 2px; border-radius: 2px; background: rgb(255 255 255 / 0.35); overflow: hidden; }
.bars i { display: block; height: 100%; width: 0; background: #fff; }
.story-who { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-weight: 600; }
.story-who .mini-avatar { width: 32px; height: 32px; border: 0; }
.story-who time { color: rgb(255 255 255 / 0.7); font-weight: 400; }
.story-who .story-close { margin-left: auto; margin-right: -4px; display: grid; place-items: center; width: 44px; height: 44px; color: #fff; }
.story-caption {
  position: absolute; inset: auto 0 0 0; z-index: 2;
  padding: 40px 16px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgb(0 0 0 / 0.55));
  font-size: 15px; text-align: center; white-space: pre-line;
}
.story-seen {
  position: absolute; left: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 3;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 16px;
  background: rgb(0 0 0 / 0.45); font-size: 13px; font-weight: 600; pointer-events: none;
  transition: opacity 200ms;
}
.story-seen .i { width: 16px; height: 16px; }
.story-seen span:empty { display: none; }
.story.held .story-seen { opacity: 0; }
.story-frame:has(.story-seen) .story-caption { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
.story-tap { position: absolute; inset: 0; z-index: 1; display: grid; grid-template-columns: 1fr 2fr; }
.story-tap button { height: 100%; }
.story-side {
  display: none;
}
@media (min-width: 768px) {
  .story-side {
    position: absolute; top: 50%; translate: 0 -50%; z-index: 3;
    display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
    background: rgb(255 255 255 / 0.85); color: #000;
    transition: opacity 200ms, background-color 150ms;
  }
  .story-side:hover { background: #fff; }
  .story-side.prev { left: -48px; }
  .story-side.next { right: -48px; }
  .story-frame { overflow: visible; }
  .story-frame img { border-radius: 10px; }
}

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 60;
  translate: -50% 12px; opacity: 0; pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px); text-align: center;
  padding: 10px 16px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-weight: 600;
  box-shadow: var(--elev);
  transition: opacity 200ms, translate 300ms var(--ease);
}
.toast.show { opacity: 1; translate: -50% 0; }
@media (min-width: 768px) { .toast { bottom: 32px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  /* Movement is gone, but opening, closing and liking still read as a quick fade. */
  .post-dialog[open] { animation: fade 160ms ease-out !important; }
  .post-dialog.leaving { animation: fade-out 140ms ease-in forwards !important; }
  .story:not([hidden]) { animation: fade 160ms ease-out !important; }
  .story.leaving { animation: fade-out 140ms ease-in forwards !important; }
  .burst { animation: fade-hold 700ms ease-out forwards !important; }
  .act.liked .i { animation: none !important; }
  .avatar-img, .avatar-bot { transition: opacity 200ms !important; transform: none !important; }
  .avatar-bot { opacity: 0; }
  .avatar.flipped .avatar-img { opacity: 0; }
  .avatar.flipped .avatar-bot { opacity: 1; }
}
@keyframes fade-hold { 0% { opacity: 0; } 20%, 70% { opacity: 1; } 100% { opacity: 0; } }


/* a cropped commenter face (GIF): the image is positioned inside a round window */
.face-crop { position: relative; display: inline-block; overflow: hidden; border-radius: 50%; flex: none; }
.face-crop img { position: absolute; max-width: none; }

/* ---------- music (Apple Music previews) ---------- */
.post-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.music {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 2px 0; font-size: 12px; color: var(--text); text-align: left;
}
.music-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; width: 12px; height: 10px; flex: none; }
.eq i { display: block; width: 2px; height: 40%; background: currentColor; border-radius: 1px; }
.eq i:nth-child(2) { height: 100%; }
.eq i:nth-child(3) { height: 65%; }
.music.playing .eq i { animation: eq 900ms ease-in-out infinite; }
.music.playing .eq i:nth-child(2) { animation-delay: -300ms; }
.music.playing .eq i:nth-child(3) { animation-delay: -600ms; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .music.playing .eq i { animation: none; } }
.music.on-dark { color: #fff; font-weight: 500; }
/* The song and the mood share the line under the name; a long song title gives way first. */
/* Song and mood stack, so a long song title never hides the mood. */
.post-sub { display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-width: 0; max-width: 100%; }
.post-sub .music { min-width: 0; }
.post-head:has(.post-sub > :nth-child(2)) { height: 66px; min-height: 66px; padding-block: 6px; }
.mood { display: inline-flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; max-width: 100%; font-size: 12px; color: var(--muted, inherit); padding: 1px 0; }
.mood .mood-ico { width: 18px; height: 18px; margin: -2px 0; flex: none; }
.mood-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-name-wrap { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.story-name time { margin-left: 8px; }
.story-music:empty { display: none; }

/* ---------- camera details ---------- */
/* Date and camera on one line: "📅 July 1, 2006 • 📷 Canon PowerShot A560" */
.post-meta {
  display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 4px 0;
  color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums;
}
.post-meta .when, .post-meta .exif { display: inline-flex; align-items: center; gap: 5px; min-width: 0; padding: 0; font-size: inherit; }
.post-meta .when { flex: none; }
.post-meta .i { width: 13px; height: 13px; flex: none; }
.post-meta .exif span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-meta .dot { font-style: normal; margin-right: 1px; }
.post-meta .exif:first-child .dot { display: none; }
.post-meta .exif.empty { display: none; }
/* Caption sits right under the likes, like Instagram */
.post-actions .caption { padding: 4px 4px 0; line-height: 1.4; overflow-wrap: anywhere; }
.post-actions .caption strong { font-weight: 600; }
.post-actions .caption p { display: inline; margin: 0; white-space: pre-line; }

/* ---------- portfolio ---------- */
.portfolio { padding: 2px 0 32px; }
.pf-cols { columns: 2; column-gap: 4px; }
@media (min-width: 900px) { .pf-cols { columns: 3; column-gap: 8px; } }
.pf-item { position: relative; overflow: hidden; display: block; margin-bottom: 4px; break-inside: avoid; background: var(--surface); }
@media (min-width: 900px) { .pf-item { margin-bottom: 8px; } }
.pf-item img { display: block; width: 100%; height: auto; transition: opacity 200ms; }
.pf-item:hover img { opacity: 0.92; }
.pf-skel { display: inline-block; width: calc(50% - 2px); margin: 0 0 4px; background: var(--surface); animation: pulse 1.4s ease-in-out infinite; }
.portfolio:has(.pf-skel) { display: flex; flex-wrap: wrap; gap: 0 4px; align-items: flex-start; }

/* ---------- story reactions and polls ---------- */
.story-react {
  position: absolute; left: 0; right: 0; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 3;
  display: flex; justify-content: center; gap: 4px; transition: opacity 200ms;
}
.story-react button {
  width: 44px; height: 44px; border-radius: 50%; font-size: 24px; line-height: 1;
  display: grid; place-items: center; transition: transform 160ms var(--ease), background-color 160ms;
}
.story-react button:active { transform: scale(1.25); }
.story-react button[aria-pressed="true"] { background: rgb(255 255 255 / 0.22); }
.story.held .story-react, .story.held .story-poll { opacity: 0; }
.story-frame:has(.story-react) .story-caption { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
.story-reacts { font-weight: 600; margin-left: 4px; }
.story-reacts:empty { display: none; }
.react-fly {
  position: fixed; z-index: 100; font-size: 34px; pointer-events: none; translate: -50% 0;
  animation: react-fly 900ms var(--ease) forwards;
}
@keyframes react-fly { 0% { transform: translateY(0) scale(0.6); opacity: 0; } 15% { opacity: 1; transform: translateY(-20px) scale(1.2); } 100% { transform: translateY(-160px) scale(1.4); opacity: 0; } }
.story-poll {
  position: absolute; left: 50%; top: 58%; z-index: 3; translate: -50% -50%;
  width: min(280px, calc(100% - 48px)); padding: 14px; border-radius: 16px;
  background: rgb(255 255 255 / 0.96); color: #111; box-shadow: 0 8px 30px rgb(0 0 0 / 0.3);
  text-align: center; transition: opacity 200ms;
}
.poll-q { margin: 2px 4px 12px; font-weight: 700; font-size: 17px; line-height: 1.3; }
.poll-opts { display: flex; flex-direction: column; gap: 8px; }
.poll-opt {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 14px; border-radius: 10px; background: #f1f1f3; font-weight: 600; font-size: 15px; color: #111;
}
button.poll-opt:active { transform: scale(0.98); }
.poll-opt.done { justify-content: space-between; }
.poll-opt.done::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: var(--pct); background: rgb(0 0 0 / 0.08);
  animation: poll-grow 600ms var(--ease);
}
.poll-opt.done.mine::before { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.poll-opt span, .poll-opt b { position: relative; }
@keyframes poll-grow { from { width: 0; } }
.poll-total { margin: 10px 0 0; font-size: 13px; color: #555; }
@media (prefers-reduced-motion: reduce) { .react-fly, .poll-opt.done::before { animation: none; } }

/* ---------- search and #tags ---------- */

.finder { max-width: 935px; margin: 0 auto; padding: 12px 16px 4px; display: grid; gap: 10px; animation: fade 200ms; }
.finder-box { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 4px 0 14px; border-radius: 12px; background: var(--surface); }
.finder-box > .i { width: 18px; height: 18px; color: var(--muted); flex: none; }
.finder-box input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: inherit; font: inherit; font-size: 16px; outline: none; }
.finder-box input::-webkit-search-cancel-button { display: none; }
.finder-box:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.finder-close { display: grid; place-items: center; width: 40px; height: 40px; color: var(--muted); border-radius: 10px; }
.finder-close .i { width: 18px; height: 18px; }
.finder-tags { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.finder-tags:empty { display: none; }
.finder-tags::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 12px; border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; transition: background-color 150ms, color 150ms; }
.chip:hover { background: var(--surface-hover); }
.chip.on { background: var(--text); color: var(--bg); }
.results-count { max-width: 935px; margin: 6px auto 8px; padding: 0 16px; color: var(--muted); font-size: 13px; }
.tag-link { color: var(--accent); font-weight: 500; }
.tag-link:hover { text-decoration: underline; }

/* ---------- link icons ---------- */

.link-ico { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 32px; height: 32px; border-radius: 8px; overflow: hidden; background: var(--bg) center/cover; }
.link-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- links tab: icon row, headings, players, backgrounds ---------- */

.social-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 2px 0 8px; }
.social {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: var(--surface); color: var(--text); font-size: 17px;
  transition: transform 200ms var(--ease), background-color 150ms;
}
.social:hover { background: var(--surface-hover); }
.social:active { transform: scale(0.92); }
.social img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; }
.social-img { width: 100%; height: 100%; background: center/cover; }
.social .i { width: 20px; height: 20px; }
.links-head { margin: 16px 2px 0; font-size: 15px; font-weight: 700; text-align: center; }
.links-head:first-child { margin-top: 4px; }
.link-embed { margin: 0; display: grid; gap: 8px; }
.link-embed figcaption { font-size: 13px; font-weight: 600; color: var(--muted); text-align: center; }
.link-embed iframe { width: 100%; border: 0; border-radius: 14px; background: var(--surface); display: block; }

/* Theme colors are plain custom properties on .links so each theme below can override them
   (they used to sit in the higher-specificity rule, which always won: every theme looked the same). */
.links { --links-bg: #1b1036; --links-fg: #fff; --glass: rgb(255 255 255 / 0.14); --glass-hover: rgb(255 255 255 / 0.22); }
.links[data-theme]:not([data-theme=""]) {
  margin-top: 16px; border-radius: 22px; padding: 24px 16px 28px; color: var(--links-fg);
  background: var(--links-bg);
}
@media (max-width: 620px) { .links[data-theme]:not([data-theme=""]) { margin: 12px 12px 0; } }
.links[data-theme="midnight"] { --links-bg: radial-gradient(120% 80% at 80% 0%, #6d28d9 0%, transparent 60%), linear-gradient(160deg, #1e0b3d, #0b0620 70%); }
.links[data-theme="sunset"] { --links-bg: linear-gradient(165deg, #ff8a5b, #e0457b 55%, #6b2d8f); }
.links[data-theme="ocean"] { --links-bg: linear-gradient(165deg, #22b8cf, #1c64d1 55%, #182a6b); }
.links[data-theme="forest"] { --links-bg: linear-gradient(165deg, #5f9c62, #2f6a4f 55%, #16302a); }
.links[data-theme="mono"] { --links-bg: linear-gradient(165deg, #3a3a3a, #111); }
.links[data-theme="blush"] { --links-bg: linear-gradient(165deg, #ffe1e8, #f7b8cf 55%, #d892b4); --links-fg: #3b1430; --glass: rgb(255 255 255 / 0.5); --glass-hover: rgb(255 255 255 / 0.7); }
.links[data-theme]:not([data-theme=""]) .link-btn,
.links[data-theme]:not([data-theme=""]) .social { background: var(--glass); color: inherit; backdrop-filter: blur(6px); }
.links[data-theme]:not([data-theme=""]) .link-btn:hover,
.links[data-theme]:not([data-theme=""]) .social:hover { background: var(--glass-hover); }
.links[data-theme]:not([data-theme=""]) .feature-card { border-color: transparent; background: var(--glass); }
.links[data-theme]:not([data-theme=""]) .link-btn .i,
.links[data-theme]:not([data-theme=""]) .feature-card .i,
.links[data-theme]:not([data-theme=""]) .feature-text span,
.links[data-theme]:not([data-theme=""]) .link-embed figcaption { color: inherit; opacity: 0.75; }
.links[data-theme]:not([data-theme=""]) .link-embed iframe { background: rgb(0 0 0 / 0.25); }
.links[data-theme]:not([data-theme=""]) .empty { color: inherit; }

/* ---------- full-screen photo viewer ---------- */

.viewer {
  position: fixed; inset: 0; z-index: 100; overflow: hidden;
  background: rgb(0 0 0 / calc(1 - var(--fade, 0) * 0.8)); color: #fff;
  touch-action: none; animation: fade 200ms ease-out;
}
.viewer.leaving { animation: fade 200ms reverse forwards; }
/* While the photo viewer is open the page behind is black too, so the status bar Safari tints from it
   matches instead of showing the theme color over the photo. */
html.viewing, html.viewing body { background: #000; }
.viewer-stage { position: absolute; inset: 0; display: grid; place-items: center; cursor: zoom-in; }
.viewer.zoomed .viewer-stage { cursor: grab; }
.viewer-stage img {
  max-width: none; max-height: none; object-fit: contain;
  background: center / contain no-repeat; transform-origin: center; will-change: transform;
}
.viewer-stage .viewer-peek { position: absolute; inset: 0; margin: auto; pointer-events: none; }
.viewer:focus { outline: none; }
@media (hover: none) { .viewer-nav { display: none; } }
.viewer-close, .viewer-nav {
  position: absolute; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: rgb(0 0 0 / 0.45); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: opacity 200ms, background-color 150ms;
}
.viewer-close { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.viewer-nav { top: 50%; translate: 0 -50%; }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
.viewer-close:hover, .viewer-nav:hover { background: rgb(0 0 0 / 0.7); }
.viewer-close .i, .viewer-nav .i { width: 22px; height: 22px; }
.viewer-count {
  position: absolute; z-index: 2; left: 50%; translate: -50% 0; bottom: calc(16px + env(safe-area-inset-bottom));
  padding: 4px 10px; border-radius: 999px; background: rgb(0 0 0 / 0.45); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.viewer.zoomed .viewer-nav, .viewer.zoomed .viewer-count { opacity: 0; pointer-events: none; }
@media (hover: none) { .viewer-nav { display: none; } }

.media-expand {
  position: absolute; left: 12px; bottom: 12px; z-index: 3;
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: rgb(0 0 0 / 0.5); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0.85; transition: opacity 150ms, transform 150ms var(--ease);
}
.media-expand:hover { opacity: 1; }
.media-expand:active { transform: scale(0.92); }
.media-expand .i { width: 17px; height: 17px; stroke-width: 2.2; }
.carousel img { cursor: default; }

/* Photos can't be long-pressed to save or dragged out. */
.grid img, .tile, .portfolio img, .pf-item, .carousel img, .carousel video, .viewer img, .story-frame img, .story-frame video,
.avatar, .hl, .feature-thumb, .link-ico, .social {
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
}
.carousel { touch-action: pan-x pan-y; }

/* ---------- swipe between tabs, pull to refresh ---------- */

.panel.slide-l { animation: slide-l 260ms var(--ease); }
.panel.slide-r { animation: slide-r 260ms var(--ease); }
@keyframes slide-l { from { opacity: 0; transform: translateX(36px); } }
@keyframes slide-r { from { opacity: 0; transform: translateX(-36px); } }

.ptr {
  position: fixed; z-index: 30; left: 50%; top: calc(env(safe-area-inset-top) + 4px);
  width: 36px; height: 36px; margin-top: -44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg); box-shadow: 0 2px 10px rgb(0 0 0 / 0.18);
  transform: translate(-50%, 0); transition: transform 240ms var(--ease);
  pointer-events: none;
}
.ptr.pulling { transition: none; }
.ptr span {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--muted); border-top-color: transparent;
  transition: border-color 150ms;
}
.ptr.ready span, .ptr.busy span { border-color: var(--text); border-top-color: transparent; }
.ptr.busy span { animation: spin 700ms linear infinite; }

@media (prefers-reduced-motion: reduce) { .panel.slide-l, .panel.slide-r { animation: none; } }

/* Note bubble over the profile photo (like Instagram Notes): Jay's own line, or Last.fm "now playing". */
.note {
  grid-area: avatar; align-self: start; justify-self: start; position: relative; z-index: 4;
  margin: -46px 0 0 -6px; max-width: 168px; pointer-events: none;
}
.profile.has-note { padding-top: 56px; }
.note-in {
  pointer-events: auto; position: relative; display: block; width: max-content; max-width: 100%;
  padding: 7px 12px; border-radius: 18px; background: var(--bg); color: var(--text);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 4px 14px rgb(0 0 0 / 0.12);
  font-size: 13px; line-height: 1.3; text-decoration: none;
}
/* The two little thought dots trailing down to the photo. */
.note-in::before, .note-in::after { content: ""; position: absolute; border-radius: 50%; background: var(--bg); box-shadow: 0 2px 6px rgb(0 0 0 / 0.1); }
.note-in::before { width: 11px; height: 11px; left: 26px; bottom: -6px; }
.note-in::after { width: 5px; height: 5px; left: 22px; bottom: -14px; }
.note-text { margin: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-sub { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.note-empty { color: var(--muted); }
.note-in:active { transform: scale(0.97); }
.eq { display: inline-flex; gap: 1.5px; align-items: flex-end; height: 9px; }
.eq i { width: 2px; height: 9px; background: var(--accent); border-radius: 1px; animation: eq 900ms ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: -300ms; }
.eq i:nth-child(3) { animation-delay: -600ms; }
@keyframes eq { from { height: 2px; } to { height: 9px; } }
.note.pop .note-in { animation: note-pop 420ms var(--ease) both; transform-origin: 26px 100%; }
@keyframes note-pop { from { opacity: 0; transform: translateY(6px) scale(0.85); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .eq i { animation: none; height: 7px; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .note-in, :root:not([data-theme="light"]) .note-in::before, :root:not([data-theme="light"]) .note-in::after { background: var(--surface); } }
:root[data-theme="dark"] .note-in, :root[data-theme="dark"] .note-in::before, :root[data-theme="dark"] .note-in::after { background: var(--surface); }
/* Folded phone header: the bubble goes with the big photo. */
body.folded .note { opacity: 0; pointer-events: none; }
@media (min-width: 768px) {
  .note { grid-row: 1 / 5; justify-self: center; margin: -30px 0 0; max-width: 190px; display: flex; justify-content: center; }
  .note-in { text-align: center; }
  .note-sub { justify-content: center; }
  .note-in::before { left: calc(50% - 14px); }
  .note-in::after { left: calc(50% - 20px); }
  .note.pop .note-in { transform-origin: 50% 100%; }
  .profile.has-note { padding-top: 34px; }
}

/* Tapping a photo presses it down a little, then it springs back. */
.tile { transition: transform 220ms var(--ease); }
.tile:active { transform: scale(0.965); transition-duration: 90ms; }
@media (prefers-reduced-motion: reduce) { .tile:active { transform: none; } }

/* On this day: first bubble in the highlights row, ringed in film orange. */
.hl-otd .hl-ring { position: relative; border: 0; padding: 3px; background: conic-gradient(from 200deg, #ff8a1f, var(--ring-a), #ff8a1f); }
.hl-otd .hl-img { border: 2px solid var(--bg); }
.otd-badge {
  position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 9px; font-weight: 700; letter-spacing: 0.02em;
  border-radius: 6px; padding: 1px 5px; border: 2px solid var(--bg); white-space: nowrap;
}

/* Peek: press and hold a photo on a touch screen. */
.peek {
  position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom));
  background: rgb(0 0 0 / 0.25); -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1);
  opacity: 0; transition: opacity 180ms; touch-action: none; -webkit-user-select: none; user-select: none;
}
.peek.on { opacity: 1; }
.peek-card {
  width: min(100%, 420px); max-height: 66dvh; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 16px; background: var(--bg); box-shadow: 0 18px 50px rgb(0 0 0 / 0.35);
  transform: scale(0.9); transition: transform 260ms var(--ease);
}
.peek.on .peek-card { transform: none; }
.peek-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-size: 14px; }
.peek-head .mini-avatar { width: 28px; height: 28px; }
.peek-img { position: relative; width: 100%; min-height: 0; flex: 1; background: var(--surface) center/cover; }
.peek-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.peek-menu {
  width: min(100%, 420px); border-radius: 14px; overflow: hidden; background: var(--bg);
  transform: translateY(10px); opacity: 0; transition: transform 260ms 40ms var(--ease), opacity 200ms 40ms;
}
.peek.on .peek-menu { transform: none; opacity: 1; }
.peek-menu button { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 15px; color: var(--text); }
.peek-menu button + button { border-top: 1px solid var(--border); }
.peek-menu button.hot, .peek-menu button:active { background: var(--surface); }
.peek-menu .i { width: 20px; height: 20px; }
.tile { -webkit-touch-callout: none; }
@media (prefers-reduced-motion: reduce) { .peek-card, .peek-menu { transition: none; transform: none; } }

/* ======================================================================
   Studio layout (default; html.studio, off with /?layout=classic).
   Wide screens: the profile is a pinned column beside the grid and posts open as a side panel.
   Phones and iPad upright: the profile is a card and posts open as a sheet you swipe down.
   ====================================================================== */
.side-col { display: contents; }

/* The pinned post is a hero tile, twice the size of the others. */
html.studio .grid > li.pinned:first-child:not(:only-child) { grid-column: span 2; grid-row: span 2; }

/* Phones and iPad upright: profile card, posts as a sheet. */
@media (max-width: 999px) {
  html.studio .profile {
    margin: 6px 10px 0; padding: 18px 14px 14px; border-radius: 20px;
    background: color-mix(in srgb, var(--surface) 55%, var(--bg));
  }
  html.studio .profile.has-note { padding-top: 58px; }
  html.studio .profile .btn { background: var(--bg); }
  html.studio .profile .btn:hover { background: var(--surface); }
  html.studio .highlights { margin-top: 12px; }
}
@media (min-width: 768px) and (max-width: 999px) {
  html.studio .profile { max-width: 935px; margin: 0 auto; padding: 28px 24px; }
  html.studio .profile.has-note { padding-top: 52px; }
}
@media (max-width: 1099px) and (orientation: portrait) {
  html.studio .post-dialog {
    inset: auto 0 0 0; height: calc(100dvh - 44px - env(safe-area-inset-top));
    border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgb(0 0 0 / 0.25);
  }
  html.studio .post-dialog::before {
    content: ""; position: absolute; z-index: 6; top: 7px; left: 50%; translate: -50% 0;
    width: 38px; height: 5px; border-radius: 3px; background: var(--border);
  }
  html.studio .post-dialog::backdrop { background: rgb(0 0 0 / 0.4); }
  html.studio .post-dialog[open] { animation: sheet-in 340ms var(--ease); }
  html.studio .post { padding-top: 8px; }
  html.studio .dialog-close { top: 14px; }
  html.studio .post-dialog.kb { inset: var(--vvt, 0) 0 auto 0; height: var(--vvh, 100%); border-radius: 0; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }

/* Wide screens: pinned profile column, grid beside it, posts as a side panel. */
@media (min-width: 1000px) {
  html.studio { --rail: 72px; }
  html.studio .rail-logo { place-items: center; padding: 0; }
  html.studio .rail-logo .wordmark { display: none; }
  html.studio .rail-logo .rail-mark { display: block; }
  html.studio .rail-item span { display: none; }

  html.studio .page {
    display: grid; grid-template-columns: 340px minmax(0, 1fr); column-gap: clamp(24px, 3vw, 48px);
    align-items: start; padding: 0 clamp(20px, 3vw, 40px) 0 0;
  }
  html.studio .page > :not(.side-col) { grid-column: 2; }
  html.studio .side-col {
    display: flex; flex-direction: column; gap: 20px;
    grid-column: 1; grid-row: 1 / span 40;
    position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; scrollbar-width: none;
    padding: 44px 28px 28px; border-right: 1px solid var(--border);
  }
  html.studio .side-col::-webkit-scrollbar { display: none; }

  html.studio .profile {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "avatar" "title" "name" "stats" "bio" "actions";
    align-items: start; align-content: start; row-gap: 0; padding: 0; margin: 0; max-width: none;
  }
  html.studio .profile.has-note { padding-top: 0; }
  html.studio .avatar { grid-area: avatar; width: 136px; height: 136px; justify-self: start; }
  html.studio .profile.has-note .avatar { margin-top: 44px; }
  html.studio .note { grid-area: avatar; justify-self: start; align-self: start; margin: 0 0 0 -2px; max-width: 260px; display: block; }
  html.studio .note-in { text-align: left; }
  html.studio .note-sub { justify-content: flex-start; }
  html.studio .note-in::before { left: 30px; }
  html.studio .note-in::after { left: 24px; }
  html.studio .username { margin-top: 18px; font-size: 22px; }
  html.studio .display-name { margin: 2px 0 0; color: var(--muted); font-weight: 500; }
  html.studio .stats { gap: 18px; margin: 12px 0 0; }
  html.studio .stats b, html.studio .stats span { font-size: 14px; }
  html.studio .bio-block { margin-top: 12px; }
  html.studio .bio-links { gap: 8px; margin-top: 14px; }
  html.studio .bio-links a {
    display: flex; justify-content: flex-start; gap: 10px; padding: 11px 14px;
    border: 1px solid var(--border); border-radius: 12px; color: var(--text);
    transition: background-color 150ms, transform 200ms var(--ease);
  }
  html.studio .bio-links a:hover { text-decoration: none; background: var(--surface); }
  html.studio .bio-links a:active { transform: scale(0.98); }
  html.studio .actions { margin-top: 16px; }
  html.studio .actions .btn { flex: 1; padding: 0 10px; white-space: nowrap; }

  html.studio .featured { grid-auto-flow: row; grid-auto-columns: auto; margin: 0; padding: 0; max-width: none; }
  html.studio .highlights { margin: 0; max-width: none; }
  html.studio .highlights-row { gap: 20px; padding: 2px 0 4px; scroll-padding-inline: 0; }
  html.studio .hl { width: 68px; }
  html.studio .hl-ring { width: 68px; height: 68px; padding: 3px; }

  html.studio .tabs-anchor { display: none; }
  html.studio .tabs { margin: 0; max-width: none; position: sticky; top: 0; z-index: 15; background: var(--bg); border-top: 0; border-bottom: 1px solid var(--border); justify-content: flex-start; gap: 36px; padding-top: 20px; }
  html.studio .tab-ind { top: auto; bottom: -1px; }
  html.studio .panel { max-width: none; margin: 16px 0 0; }
  html.studio .foot { margin: 0; }
  html.studio .grid, html.studio .portfolio { max-width: 1440px; margin: 0; }
  html.studio .words { max-width: 980px; margin: 0; }

  /* The post slides in from the right; the profile column stays in view. */
  html.studio .post-dialog {
    position: fixed; inset: 0 0 0 auto; margin: 0;
    width: min(500px, 40vw); height: 100%; max-width: none; max-height: none;
    border-radius: 0; overflow: hidden; box-shadow: -18px 0 50px rgb(0 0 0 / 0.18);
    /* iPad: keep the header out from under the status bar, which Safari blurs and tints. */
    box-sizing: border-box; padding-top: env(safe-area-inset-top);
  }
  html.studio .post-dialog::backdrop { background: rgb(0 0 0 / 0.14); }
  html.studio .post-dialog[open] { animation: panel-in 300ms var(--ease); }
  html.studio .post-dialog.leaving { animation: panel-out 200ms ease-in forwards; }
  html.studio .post {
    height: 100%; overflow-y: auto;
    grid-template-columns: minmax(0, 1fr); grid-template-rows: none;
    grid-template-areas: "head" "media" "actions" "thread" "form";
  }
  html.studio .post-media { height: auto; border-radius: 0; }
  html.studio .carousel { height: auto; aspect-ratio: var(--ar, 0.75); max-height: 72vh; }
  html.studio .post-head { padding: 0 56px 0 16px; }
  html.studio .post-thread { overflow: visible; border-bottom: 0; padding: 4px 16px 12px; }
  html.studio .comment-form { position: sticky; bottom: 0; background: var(--bg); }
  html.studio .dialog-close { position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 8px; left: auto; color: var(--text); }
  html.studio .post-nav { display: none; }
  html.studio .link-slot.in-thread { display: block; }
  html.studio .link-slot.in-actions { display: none; }
}
@keyframes panel-in { from { transform: translateX(48px); opacity: 0; } }
@keyframes panel-out { to { transform: translateX(48px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html.studio .post-dialog[open], html.studio .post-dialog.leaving { animation: fade 160ms ease-out; }
}

/* ---------- Links builder (owner only): the Links tab becomes its own editor ---------- */

.lb-entry { display: flex; justify-content: flex-end; max-width: 580px; margin: 14px auto 0; padding: 0 16px; }
.lb-entry .btn { flex: none; }
.lb-on .lb-entry { display: none; }

.lb-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  max-width: 580px; margin: 14px auto 0; padding: 0 16px;
}
.lb-themes { display: flex; gap: 8px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 3px; margin: -3px; }
.lb-themes::-webkit-scrollbar { display: none; }
.lb-themes label { position: relative; flex: none; cursor: pointer; }
.lb-themes input { position: absolute; opacity: 0; pointer-events: none; }
.lb-sw { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); transition: transform 200ms var(--ease); }
.lb-themes label:hover .lb-sw { transform: scale(1.08); }
.lb-themes input:checked + .lb-sw { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.lb-themes input:focus-visible + .lb-sw { outline: 2px solid var(--accent); outline-offset: 4px; }
.lb-sw[data-sw="midnight"] { background: radial-gradient(120% 80% at 80% 0%, #6d28d9 0%, transparent 60%), linear-gradient(160deg, #1e0b3d, #0b0620 70%); }
.lb-sw[data-sw="sunset"] { background: linear-gradient(165deg, #ff8a5b, #e0457b 55%, #6b2d8f); }
.lb-sw[data-sw="ocean"] { background: linear-gradient(165deg, #22b8cf, #1c64d1 55%, #182a6b); }
.lb-sw[data-sw="forest"] { background: linear-gradient(165deg, #5f9c62, #2f6a4f 55%, #16302a); }
.lb-sw[data-sw="mono"] { background: linear-gradient(165deg, #3a3a3a, #111); }
.lb-sw[data-sw="blush"] { background: linear-gradient(165deg, #ffe1e8, #f7b8cf 55%, #d892b4); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.lb-bar .btn { flex: none; order: 2; }
.lb-bar .lb-switch { order: 3; }
.lb-done { min-width: 76px; }

.lb-switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; flex: none; }
.lb-switch input { position: absolute; opacity: 0; pointer-events: none; }
.lb-track { position: relative; width: 40px; height: 24px; border-radius: 12px; background: var(--surface-hover); transition: background-color 200ms; flex: none; }
.lb-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 220ms var(--ease); }
.lb-switch input:checked + .lb-track { background: var(--accent); }
.lb-switch input:checked + .lb-track::after { transform: translateX(16px); }
.lb-switch input:focus-visible + .lb-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The blocks: each one in a dashed box (like lnk.bio's editor) with an Edit Block pill on top and a
   handle on the left; "Add Block" rows between them. The block inside is the real thing. */
.lb-on .links { gap: 0; }
.lb-box, .lb-block {
  position: relative; border: 1.5px dashed color-mix(in srgb, currentColor 32%, transparent); border-radius: 16px;
  padding: 14px 12px 12px; transition: transform 200ms var(--ease), border-color 150ms, background-color 150ms;
}
.lb-box { padding: 16px 10px 10px; }
.lb-block { cursor: pointer; }
.lb-block:hover { border-color: color-mix(in srgb, currentColor 60%, transparent); background: color-mix(in srgb, currentColor 3%, transparent); }
.lb-item.editing { border-style: solid; border-color: var(--accent); }
.links[data-theme]:not([data-theme=""]) .lb-item.editing { border-color: currentColor; }
.lb-pill {
  position: absolute; top: 0; left: 50%; translate: -50% -55%; z-index: 1; padding: 3px 10px; border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
}
.lb-item.editing .lb-pill { background: var(--accent); color: var(--accent-text); }
.lb-socials { padding-bottom: 0; }
.lb-socials .lb-item { cursor: pointer; touch-action: pan-y; transition: transform 200ms var(--ease), opacity 150ms; }
.lb-socials .lb-item.dragging { transition: none; z-index: 2; box-shadow: var(--elev); }
.lb-socials .lb-item.off { opacity: 0.45; }
.lb-socials .lb-item.editing { outline: 2px solid var(--accent); outline-offset: 3px; }
.links[data-theme]:not([data-theme=""]) .lb-socials .lb-item.editing { outline-color: currentColor; }
.lb-add-social { border: 1.5px dashed currentColor; background: none !important; opacity: 0.55; color: inherit; }
.lb-add-social:hover { opacity: 0.9; }
.lb-list { display: flex; flex-direction: column; }
.lb-block.dragging { transition: none; z-index: 3; background: var(--bg); box-shadow: var(--elev); }
.links[data-theme]:not([data-theme=""]) .lb-block.dragging { background: var(--glass); backdrop-filter: blur(10px); }
.lb-render { position: relative; min-width: 0; outline: none; }
.lb-render > * { pointer-events: none; }
.lb-render .links-head { margin: 4px 2px; }
.lb-render:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 10px; }
.lb-block.off .lb-render { opacity: 0.45; }
.lb-item.saved { animation: lb-saved 900ms var(--ease); }
@keyframes lb-saved { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
.lb-grip {
  position: absolute; left: 0; top: 50%; translate: -50% -50%; z-index: 2;
  display: grid; place-items: center; width: 26px; height: 44px; border-radius: 13px;
  background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.15);
  cursor: grab; touch-action: none; transition: background-color 150ms, transform 150ms var(--ease);
}
.lb-grip:hover { background: var(--surface-hover); }
.lb-block.dragging .lb-grip { cursor: grabbing; transform: scale(1.08); }
.lb-grip .i { width: 16px; height: 16px; stroke-width: 2.8; }
.lb-flag {
  position: absolute; top: 0; left: 14px; translate: 0 -55%; z-index: 1; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 11px; font-weight: 700; pointer-events: none;
}
.lb-flag .i { width: 12px; height: 12px; }
.lb-flag.warn { background: #b45309; color: #fff; }
.lb-empty { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 52px; padding: 6px; opacity: 0.75; }
.lb-empty > .i { width: 22px; height: 22px; flex: none; }
.lb-empty span { display: grid; }
.lb-empty b { font-size: 15px; }
.lb-empty small { font-size: 12px; opacity: 0.8; }

/* Add Block: a dashed row between blocks. */
.lb-add {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px; margin: 12px 0;
  border: 1.5px dashed color-mix(in srgb, currentColor 28%, transparent); border-radius: 14px;
  color: inherit; font-weight: 600; font-size: 14px; opacity: 0.6; transition: opacity 150ms, border-color 150ms, background-color 150ms;
}
.lb-add .i { width: 16px; height: 16px; stroke-width: 2.4; }
.lb-add:hover, .lb-add:focus-visible { opacity: 1; border-color: color-mix(in srgb, currentColor 60%, transparent); background: color-mix(in srgb, currentColor 4%, transparent); }
.lb-list:empty + .lb-add { height: 64px; }
.lb-dragging .lb-add { visibility: hidden; }

/* The editor: a sheet from the bottom (phones, iPad portrait), a panel on the right (wider screens). */
.lb-sheet {
  position: fixed; inset: auto 0 0 0; z-index: 60;
  display: grid; gap: 10px; max-height: min(72dvh, 600px); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 16px 0;
  background: var(--bg); color: var(--text); border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgb(0 0 0 / 0.18), 0 0 0 1px var(--border);
  transform: translateY(105%); transition: transform 260ms var(--ease);
}
.lb-sheet.in { transform: none; }
.lb-sheet-head { position: sticky; top: -8px; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 8px 0 2px; background: var(--bg); font-size: 16px; }
.lb-x { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; margin-right: -6px; background: var(--surface); }
.lb-x .i { width: 18px; height: 18px; }
.lb-head-ic { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 8px; border-radius: 8px; background: var(--surface); vertical-align: middle; }
.lb-head-ic .i { width: 16px; height: 16px; }
.lb-seg { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--surface); }
.lb-seg label { flex: 1; min-width: 0; cursor: pointer; }
.lb-seg input { position: absolute; opacity: 0; pointer-events: none; }
.lb-seg span { display: flex; align-items: center; justify-content: center; gap: 5px; height: 34px; padding: 0 6px; border-radius: 9px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--muted); transition: background-color 150ms, color 150ms; }
.lb-seg span .i { width: 15px; height: 15px; flex: none; }
.lb-seg input:checked + span { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.lb-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 400px) { .lb-styles span .i { display: none; } }
.lb-field textarea {
  min-height: 110px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: inherit;
  font: inherit; font-size: 16px; line-height: 1.45; resize: vertical;
}
.lb-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.lb-photo { display: grid; gap: 8px; justify-items: start; }
.lb-photo-preview { display: grid; place-items: center; width: 100%; height: 160px; border-radius: 14px; background: var(--surface) center/cover; color: var(--muted); }
.lb-photo-preview .i { width: 28px; height: 28px; }
.lb-photo-preview.busy { animation: lb-pulse 900ms ease-in-out infinite alternate; }
.lb-photo .btn { flex: none; cursor: pointer; }
.lb-gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.lb-gal-item, .lb-gal-add { position: relative; aspect-ratio: 1; border-radius: 12px; background: var(--surface) center/cover; }
.lb-gal-add { display: grid; place-content: center; justify-items: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; border: 1.5px dashed var(--border); background: none; }
.lb-gal-add .i { width: 18px; height: 18px; }
.lb-gal-add.busy { animation: lb-pulse 900ms ease-in-out infinite alternate; }
.lb-gal-x { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgb(0 0 0 / 0.6); color: #fff; }
.lb-gal-x .i { width: 13px; height: 13px; stroke-width: 2.6; }
.lb-find { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border-radius: 22px; border: 1.5px solid var(--border); background: var(--bg); }
.lb-find:focus-within { border-color: var(--accent); }
.lb-find .i { width: 17px; height: 17px; color: var(--muted); flex: none; }
.lb-find input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: inherit; font: inherit; font-size: 16px; outline: none; }
.lb-song { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.lb-song.picked { padding: 8px; border-radius: 12px; background: var(--surface); }
.lb-results { display: grid; gap: 2px; }
.lb-results:empty { display: none; }
.lb-song-row { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; text-align: left; }
.lb-song-row:hover { background: var(--surface); }
.lb-sheet .lm-art { width: 40px; height: 40px; flex: none; border-radius: 8px; background: var(--surface-hover) center/cover; }
.lb-sheet .lm-text { display: grid; min-width: 0; }
.lb-sheet .lm-text strong, .lb-sheet .lm-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.lb-sheet .lm-text span { color: var(--muted); font-size: 13px; }

/* The block picker */
.lb-picker { max-height: min(84dvh, 720px); }
.lb-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 4px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
@media (max-width: 360px) { .lb-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.lb-kind { display: grid; justify-items: center; align-content: start; gap: 6px; padding: 10px 2px; border-radius: 14px; text-align: center; transition: background-color 150ms; }
.lb-kind:hover, .lb-kind:focus-visible { background: var(--surface); }
.lb-kind-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); transition: transform 200ms var(--ease); }
.lb-kind:hover .lb-kind-ic { transform: scale(1.06); }
.lb-kind-ic .i { width: 21px; height: 21px; }
.lb-kind b { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.lb-kind small { display: none; }
.lb-none { margin: 0; padding: 20px 0; text-align: center; color: var(--muted); }
.lb-field { display: grid; gap: 5px; }
.lb-field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.lb-field input {
  height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: inherit; font: inherit; font-size: 16px;
}
.lb-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.lb-image { display: flex; align-items: center; gap: 10px; }
.lb-image .btn { flex: none; cursor: pointer; }
.lb-thumb { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--surface) center/cover; color: var(--muted); flex: none; }
.lb-thumb.busy { animation: lb-pulse 900ms ease-in-out infinite alternate; }
@keyframes lb-pulse { to { opacity: 0.4; } }
.lb-hint { margin: -4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
/* Save stays in reach while the sheet scrolls. */
.lb-actions {
  position: sticky; bottom: 0; z-index: 1; display: flex; align-items: center; gap: 8px;
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--bg);
}
.lb-actions .btn { flex: none; height: 40px; }
.lb-spacer { flex: 1; }
.btn.small { height: 34px; padding: 0 12px; font-size: 14px; }
.btn.danger { color: var(--like); }
@media (max-width: 380px) { .lb-actions .danger { padding: 0 10px; } }
/* Room to scroll the last blocks above the sheet. */
html.lb-editing .page { padding-bottom: 70dvh; }

@media (min-width: 600px) and (max-width: 999px) {
  .lb-sheet { left: 50%; right: auto; width: 560px; translate: -50% 0; }
}
@media (min-width: 1000px) {
  .lb-sheet {
    inset: 0 0 0 auto; width: min(400px, 36vw); max-height: none; border-radius: 0;
    padding: 12px 22px 0; align-content: start;
    box-shadow: -18px 0 50px rgb(0 0 0 / 0.14), -1px 0 0 var(--border);
    transform: translateX(105%);
  }
  .lb-picker {
    inset: 50% auto auto 50%; width: 560px; max-height: min(86dvh, 760px); border-radius: 20px; padding: 14px 20px 0;
    translate: -50% -50%; transform: scale(0.96); opacity: 0; transition: transform 220ms var(--ease), opacity 160ms;
    box-shadow: 0 30px 80px rgb(0 0 0 / 0.28), 0 0 0 1px var(--border);
  }
  .lb-picker.in { transform: none; opacity: 1; }
  .lb-grid { gap: 8px; }
  html.lb-editing .page { padding-bottom: 0; }
  /* The page makes room so the block being edited stays in view beside the panel. */
  html.lb-editing:has(.lb-editor) #panel-links { padding-right: calc(min(400px, 36vw) + 8px); transition: padding 260ms var(--ease); }
  html.lb-editing:has(.lb-picker) .page::after { content: ""; position: fixed; inset: 0; z-index: 55; background: rgb(0 0 0 / 0.35); animation: fade 160ms; }
}
@media (prefers-reduced-motion: reduce) { .lb-sheet, .lb-block, .lb-socials .lb-item { transition: none; } }

/* Framed by the dashboard's Links page: just the builder. */
html.lb-embed .rail, html.lb-embed .topbar, html.lb-embed .bottombar, html.lb-embed .side-col, html.lb-embed .profile, html.lb-embed .featured,
html.lb-embed .highlights, html.lb-embed .tabs-anchor, html.lb-embed .tabs, html.lb-embed .foot, html.lb-embed .lb-entry { display: none !important; }
html.lb-embed .page, html.lb-embed.studio .page { display: block; margin: 0; padding: 0 0 24px; }
html.lb-embed .panel, html.lb-embed.studio .panel { margin: 0 auto; max-width: none; }
html.lb-embed .lb-bar { margin-top: 16px; }
html.lb-embed body { background: var(--bg); }
.lb-tip { order: 9; flex-basis: 100%; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.lb-tip .i { width: 14px; height: 14px; vertical-align: -2px; stroke-width: 2.4; }
/* ======================================================================
   Links: Bento from 768px. Every block is a tile on a 6-column grid; renderLinks()
   gives each one a span (b2, b3, b4; none = full row) so rows always fill.
   Socials sit in a tile beside the first video, or as chips on top.
   Phones keep one column (socials first), and the editor stays one column too.
   ====================================================================== */
.social-name { display: none; }
.social-ico { display: contents; }
.links > .social-row { order: -1; }

@media (min-width: 768px) {
  html:not(.lb-on) .links {
    --tile: var(--surface); --tile-hover: var(--surface-hover); --tile-sub: var(--muted);
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; align-items: stretch;
    max-width: 980px; padding: 24px 24px 40px;
  }
  html:not(.lb-on) .links[data-theme]:not([data-theme=""]) { --tile: var(--glass); --tile-hover: var(--glass-hover); --tile-sub: currentColor; padding: 22px; }
  html:not(.lb-on) .links > * { grid-column: span 6; min-width: 0; margin: 0; }
  html:not(.lb-on) .links > .b2 { grid-column: span 2; }
  html:not(.lb-on) .links > .b3 { grid-column: span 3; }
  html:not(.lb-on) .links > .b4 { grid-column: span 4; }
  html:not(.lb-on) .links > .social-row { order: 0; }
  html:not(.lb-on) .links > .links-head { margin: 12px 2px -2px; font-size: 15px; text-align: left; }
  html:not(.lb-on) .links > .links-head:first-child { margin-top: 0; }

  /* Players sit in a tile with their title. */
  html:not(.lb-on) .links > .link-embed { padding: 12px; border-radius: 18px; background: var(--tile); align-content: start; }
  html:not(.lb-on) .links > .link-embed figcaption { text-align: left; margin: 2px 4px 2px; }
  html:not(.lb-on) .links > .link-embed iframe { border-radius: 12px; }

  /* Buttons and cards fill their tile. */
  html:not(.lb-on) .links > .link-btn { min-height: 60px; height: 100%; }
  html:not(.lb-on) .links > .feature-card { height: 100%; }

  /* Socials: a list with names and handles beside the video, or chips across the top. */
  html:not(.lb-on) .links > .social-row { padding: 0; gap: 2px; justify-content: flex-start; }
  html:not(.lb-on) .links > .social-row.b-side { grid-column: span 2; display: flex; flex-direction: column; flex-wrap: nowrap; padding: 12px 8px; border-radius: 18px; background: var(--tile); }
  html:not(.lb-on) .links > .social-row.b-chips { gap: 8px; }
  html:not(.lb-on) .links .social-row .social {
    width: auto; height: auto; border-radius: 12px; display: flex; align-items: center; gap: 10px; overflow: visible;
    padding: 7px 8px; background: transparent; backdrop-filter: none; font-size: 14px; font-weight: 600; color: inherit;
  }
  html:not(.lb-on) .links .social-row.b-chips .social { padding: 5px 16px 5px 5px; border-radius: 999px; background: var(--tile); }
  html:not(.lb-on) .links .social-row .social:hover { background: var(--tile-hover); }
  html:not(.lb-on) .links .social-row .social-ico {
    flex: none; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
    background: var(--bg); color: var(--text); font-size: 15px;
  }
  html:not(.lb-on) .links .social-row .social-ico img { width: 22px; height: 22px; }
  html:not(.lb-on) .links .social-row .social-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
  html:not(.lb-on) .links .social-row .social-name em { font-style: normal; font-weight: 500; font-size: 12px; color: var(--tile-sub); opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html:not(.lb-on) .links .social-row.b-chips .social-name { flex-direction: row; gap: 6px; align-items: baseline; }
}
@media (min-width: 1000px) {
  html.studio .links { max-width: 1440px; margin-left: 0; margin-right: 0; }
  html.studio:not(.lb-on) .links:not([data-theme]), html.studio:not(.lb-on) .links[data-theme=""] { padding-left: 0; padding-right: 0; }
  html.studio .words { --year-top: 72px; max-width: 900px; padding-left: 0; padding-right: 0; }
}

/* While editing, the Links tab is one column so blocks can be dragged and + sits between them. */
html.lb-on .links { max-width: 620px; margin-left: auto; margin-right: auto; }
.lb-bar { max-width: 620px; }
@media (min-width: 768px) { .lb-entry { max-width: 935px; padding: 0 24px; } }
@media (min-width: 1000px) { html.studio .lb-entry { max-width: 1440px; margin-left: 0; padding: 0; } }

/* ---------- Links blocks: text, photos, timers and the rest ---------- */
.links-head.big { font-size: 24px; letter-spacing: -0.02em; line-height: 1.2; }
.link-text { margin: 4px 2px; font-size: 15px; line-height: 1.55; text-align: center; overflow-wrap: anywhere; }
.link-text.left { text-align: left; }
.link-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.link-image { margin: 0; display: grid; gap: 8px; }
.link-image img { display: block; width: 100%; height: auto; max-height: 560px; object-fit: cover; border-radius: 16px; background: var(--surface); }
.link-image a { display: block; border-radius: 16px; transition: transform 200ms var(--ease); }
.link-image a:active { transform: scale(0.985); }
.link-image figcaption, .link-gallery figcaption, .link-map figcaption { font-size: 13px; font-weight: 600; color: var(--muted); text-align: center; }
.link-gallery { margin: 0; display: grid; gap: 8px; min-width: 0; }
.gal-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: 62%; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; border-radius: 16px; overscroll-behavior-x: contain;
}
.gal-strip::-webkit-scrollbar { display: none; }
.link-gallery.one .gal-strip { grid-auto-columns: 100%; }
.gal-item { scroll-snap-align: start; aspect-ratio: 4 / 5; border-radius: 16px; overflow: hidden; background: var(--surface); }
.gal-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 300ms var(--ease); }
.gal-item:active img { transform: scale(0.98); }
@media (min-width: 768px) { .gal-strip { grid-auto-columns: calc((100% - 16px) / 3); } .link-gallery.one .gal-strip { grid-auto-columns: 100%; } .link-gallery.one .gal-item { aspect-ratio: 16 / 9; } }
.link-line { width: 100%; margin: 6px 0; border: 0; border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
.link-space.s-s { height: 4px; }
.link-space.s-m { height: 20px; }
.link-space.s-l { height: 48px; }
.link-countdown { display: grid; justify-items: center; gap: 10px; padding: 16px 12px; border-radius: 16px; background: var(--surface); text-align: center; }
.link-countdown strong { font-size: 15px; }
.cd-units { display: flex; gap: 8px; justify-content: center; }
.cd-units span { display: grid; justify-items: center; min-width: 58px; padding: 8px 4px; border-radius: 12px; background: var(--bg); }
.cd-units b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.cd-units small { font-size: 11px; color: var(--muted); font-weight: 600; }
.cd-done { margin: 0; font-size: 18px; font-weight: 700; }
.link-tip, .link-copy, .link-btn[data-share] { padding-left: 56px; }
.tip-ico { display: grid; place-items: center; background: color-mix(in srgb, var(--like) 14%, var(--bg)) !important; color: var(--like); }
.link-copy .tip-ico, .link-btn[data-share] .tip-ico { background: var(--bg) !important; color: var(--text); }
.tip-ico .i { position: static; width: 17px; height: 17px; color: inherit; }
.tip-text { display: grid; }
.tip-text small { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.link-map { margin: 0; display: grid; gap: 8px; }
.link-map iframe { width: 100%; height: 260px; border: 0; border-radius: 16px; background: var(--surface); display: block; }
.link-map figcaption a { display: inline-flex; align-items: center; gap: 5px; color: inherit; }
.link-map figcaption .i { width: 14px; height: 14px; }
.link-music { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: 16px; background: var(--surface); }
.link-music .lm-art { width: 56px; height: 56px; flex: none; border-radius: 10px; background: var(--surface-hover) center/cover; }
.link-music .lm-text { display: grid; flex: 1; min-width: 0; text-align: left; }
.link-music .lm-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-music .lm-text small { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.link-music .lm-text strong { font-size: 15px; }
.link-music .lm-text span { font-size: 13px; color: var(--muted); }
.lm-play { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--text); color: var(--bg); transition: transform 150ms var(--ease); }
.lm-play:active { transform: scale(0.92); }
.lm-play .i { width: 18px; height: 18px; margin-left: 2px; fill: currentColor; }
.lm-play .lm-off { display: none; }
.lm-play.playing .lm-on { display: none; }
.lm-play.playing .lm-off { display: inline-flex; }
.link-search { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-radius: 14px; background: var(--surface); }
.link-search > .i { width: 18px; height: 18px; color: var(--muted); flex: none; }
.link-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: inherit; font: inherit; font-size: 16px; outline: none; }
.link-search:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.link-counter { display: grid; justify-items: center; gap: 2px; padding: 10px; text-align: center; }
.link-counter b { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.link-counter span { font-size: 13px; font-weight: 600; color: var(--muted); }
.link-embed.narrow iframe { max-width: 380px; margin: 0 auto; }

/* The same blocks on a Links background */
.links[data-theme]:not([data-theme=""]) .link-countdown,
.links[data-theme]:not([data-theme=""]) .link-music,
.links[data-theme]:not([data-theme=""]) .link-search { background: var(--glass); backdrop-filter: blur(6px); }
.links[data-theme]:not([data-theme=""]) .cd-units span { background: rgb(255 255 255 / 0.12); }
.links[data-theme="blush"] .cd-units span { background: rgb(255 255 255 / 0.5); }
.links[data-theme]:not([data-theme=""]) .cd-units small,
.links[data-theme]:not([data-theme=""]) .link-music .lm-text small,
.links[data-theme]:not([data-theme=""]) .link-music .lm-text span,
.links[data-theme]:not([data-theme=""]) .link-counter span,
.links[data-theme]:not([data-theme=""]) .link-image figcaption,
.links[data-theme]:not([data-theme=""]) .link-gallery figcaption,
.links[data-theme]:not([data-theme=""]) .link-map figcaption,
.links[data-theme]:not([data-theme=""]) .link-search > .i,
.links[data-theme]:not([data-theme=""]) .tip-text small { color: inherit; opacity: 0.75; }
.links[data-theme]:not([data-theme=""]) .link-search input::placeholder { color: inherit; opacity: 0.7; }
.links[data-theme]:not([data-theme=""]) .lm-play { background: var(--links-fg); color: var(--links-bg-solid, #1b1036); }
.links[data-theme]:not([data-theme=""]) .link-tip .tip-ico,
.links[data-theme]:not([data-theme=""]) .link-copy .tip-ico,
.links[data-theme]:not([data-theme=""]) .link-btn[data-share] .tip-ico { background: rgb(255 255 255 / 0.2) !important; color: inherit; }
.links[data-theme]:not([data-theme=""]) .link-tip .i, .links[data-theme]:not([data-theme=""]) .link-copy .i { opacity: 1; }
.lm-play.playing .eq i { animation: eq 900ms ease-in-out infinite; }
.lm-play .eq { width: 14px; height: 14px; }

/* Big headlines stay big and centered on the Bento grid. */
@media (min-width: 768px) {
  html:not(.lb-on) .links > .links-head.big { margin: 14px 2px 0; font-size: 28px; text-align: center; }
}

/* ======================================================================
   Links studio: the dashboard's Links page on big screens. A list of blocks
   (Stats page look: tiles, section heads, grey rows) beside a live preview
   of the real page on a phone or a computer. Phones edit on the page itself.
   ====================================================================== */
html.lb-studio .page { display: none !important; }
html.lb-studio body { background: var(--bg); }
.lbs { padding: 4px 0 32px; }
.lbs-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 24px; }
.lbs-tiles > div { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 12px; background: var(--surface); min-width: 0; }
.lbs-tiles b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lbs-tiles span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbs-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 44%); gap: 28px; align-items: start; }
.lbs-right { position: sticky; top: 12px; }
.lbs-group { margin-bottom: 24px; }
.lbs-ghead { display: flex; align-items: center; gap: 10px; min-height: 34px; margin-bottom: 10px; }
.lbs-ghead h3 { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.lbs-hint { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; opacity: 0.8; }
.lbs-addbtn { display: inline-flex; align-items: center; gap: 6px; height: 34px; margin-left: auto; padding: 0 12px; border-radius: 10px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; transition: background-color 150ms, transform 150ms var(--ease); }
.lbs-addbtn:hover { background: var(--surface-hover); }
.lbs-addbtn:active { transform: scale(0.97); }
.lbs-addbtn.primary { background: var(--accent); color: var(--accent-text); }
.lbs-addbtn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.lbs-addbtn .i { width: 16px; height: 16px; stroke-width: 2.4; }
.lbs-rows { display: grid; gap: 6px; }
.lbs-row {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 10px 8px 4px;
  border-radius: 12px; background: var(--surface); cursor: pointer; transition: background-color 150ms, transform 200ms var(--ease);
}
.lbs-row:hover { background: var(--surface-hover); }
.lbs-row.off .lbs-name, .lbs-row.off .lbs-ic { opacity: 0.45; }
.lbs-row.dragging { z-index: 2; background: var(--bg); box-shadow: 0 12px 30px rgb(0 0 0 / 0.16), 0 0 0 1px var(--border); transition: none; }
.lbs-row .lb-grip { position: static; translate: none; flex: none; width: 26px; height: 40px; background: none; box-shadow: none; color: var(--muted); }
.lbs-row .lb-grip:hover { background: var(--bg); color: var(--text); }
.lbs-ic { display: grid; place-items: center; flex: none; width: 38px; height: 38px; overflow: hidden; border-radius: 10px; background: var(--bg) center/cover; color: var(--text); }
.lbs-ic img { width: 20px; height: 20px; border-radius: 4px; }
.lbs-ic .i { width: 18px; height: 18px; }
.lbs-name { display: grid; flex: 1; min-width: 0; outline: none; }
.lbs-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.lbs-name b, .lbs-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbs-name b { font-size: 14px; font-weight: 600; }
.lbs-name small { color: var(--muted); font-size: 12.5px; }
.lbs-row .lb-flag { position: static; translate: none; flex: none; }
.lbs-taps { flex: none; color: var(--muted); font-size: 12.5px; font-style: normal; font-variant-numeric: tabular-nums; }
.lbs-eye { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); transition: background-color 150ms; }
.lbs-eye:hover { background: var(--bg); color: var(--text); }
.lbs-eye .i { width: 18px; height: 18px; }
.lbs-chev { display: grid; flex: none; color: var(--muted); }
.lbs-chev .i { width: 16px; height: 16px; }
.lbs-empty { margin: 0; padding: 16px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: 14px; text-align: center; }
.lbs-style .lb-bar { max-width: none; margin: 0; padding: 14px; border-radius: 12px; background: var(--surface); }
.lbs-style .lb-sw { box-shadow: inset 0 0 0 1px var(--border), 0 0 0 2px var(--bg); }

/* The preview */
.lbs-right .lbs-ghead h3 { flex: 1; }
.lbs-seg { display: flex; padding: 3px; border-radius: 10px; background: var(--surface); }
.lbs-seg label { position: relative; }
.lbs-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.lbs-seg span { display: block; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.lbs-seg input:checked + span { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.lbs-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.lbs-live { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 13px; font-weight: 600; }
.lbs-live .i { width: 14px; height: 14px; }
.lbs-stage { display: grid; justify-items: center; padding: 20px; border-radius: 16px; background: var(--surface); }
.lbs-device { position: relative; overflow: hidden; overflow: clip; isolation: isolate; background: var(--bg); transition: width 220ms var(--ease), height 220ms var(--ease); }
.lbs-device[data-device="phone"] { box-sizing: border-box; padding: 11px; border-radius: 40px; background: #111; box-shadow: 0 18px 40px rgb(0 0 0 / 0.22); }
.lbs-device[data-device="phone"] iframe { border-radius: 4px; }
.lbs-device[data-device="computer"] { border-radius: 3px; box-shadow: 0 0 0 1px var(--border), 0 14px 36px rgb(0 0 0 / 0.14); }
.lbs-device iframe { display: block; border: 0; transform-origin: 0 0; background: var(--bg); }
.lbs-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; text-align: center; }

/* The editor takes the list's place while it's open. */
html.lb-studio.lb-editing .lbs-left > :not(.lb-sheet) { display: none; }
.lbs-left > .lb-editor {
  position: static; inset: auto; width: auto; max-height: none; overflow: visible; translate: none; transform: none; opacity: 1;
  padding: 14px 18px 0; border-radius: 16px; box-shadow: 0 0 0 1px var(--border); transition: none;
}
.lbs-left > .lb-editor .lb-sheet-head { top: 0; }
html.lb-studio.lb-editing:has(.lb-picker) body::after { content: ""; position: fixed; inset: 0; z-index: 55; background: rgb(0 0 0 / 0.35); animation: fade 160ms; }

/* The block you just picked or saved, flashed in the preview. */
.lb-ping { animation: lb-ping 1400ms var(--ease); }
@keyframes lb-ping { 0%, 55% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px color-mix(in srgb, var(--accent) 25%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }
@media (prefers-reduced-motion: reduce) { .lbs-device, .lbs-row { transition: none; } .lb-ping { animation-duration: 1ms; } }
/* Very wide screens: four photos across, so tiles stay a comfortable size while filling the width. */
@media (min-width: 1600px) {
  html.studio .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ======================================================================
   Links text styles (Edit Links → Text): font, size and color for headings
   and block titles. Set as data-font / data-size / data-color on #links.
   The font list lives in fonts.js. Fonts are self-hosted (OFL) and only download when that style is picked.
   ====================================================================== */
@font-face { font-family: "Anton"; src: url(/fonts/anton-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url(/fonts/space-mono-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url(/fonts/space-grotesk-400-700.woff2) format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(/fonts/nunito-400-800.woff2) format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url(/fonts/fraunces-400-700-italic.woff2) format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url(/fonts/playfair-400-800.woff2) format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url(/fonts/instrument-serif-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url(/fonts/instrument-serif-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Bebas Neue"; src: url(/fonts/bebas-neue-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Oswald"; src: url(/fonts/oswald-400-700.woff2) format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url(/fonts/space-mono-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/fonts/plex-mono-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/fonts/plex-mono-700.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url(/fonts/courier-prime-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url(/fonts/courier-prime-700.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Caveat"; src: url(/fonts/caveat-400-700.woff2) format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Dancing Script"; src: url(/fonts/dancing-script-400-700.woff2) format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Pacifico"; src: url(/fonts/pacifico-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

#links { --t-head: 22px; --t-cap: 17px; --t-scale: 1; }
#links[data-size="s"] { --t-head: 17px; --t-cap: 14px; }
#links[data-size="l"] { --t-head: 32px; --t-cap: 22px; }
@media (min-width: 768px) {
  #links { --t-head: 28px; --t-cap: 19px; }
  #links[data-size="s"] { --t-head: 19px; --t-cap: 15px; }
  #links[data-size="l"] { --t-head: 44px; --t-cap: 26px; }
}
#links[data-font="rounded"] { --t-scale: 1.02; }
#links[data-font="playfair"] { --t-scale: 1.02; }
#links[data-font="instrument"] { --t-scale: 1.15; }
#links[data-font="poster"] { --t-scale: 1.05; }
#links[data-font="bebas"] { --t-scale: 1.18; }
#links[data-font="mono"] { --t-scale: 0.82; }
#links[data-font="plex"] { --t-scale: 0.86; }
#links[data-font="courier"] { --t-scale: 0.95; }
#links[data-font="script"] { --t-scale: 1.3; }
#links[data-font="dancing"] { --t-scale: 1.2; }

#links .links-head, #links :not(.link-map) > figcaption {
  font-size: calc(var(--t-head) * var(--t-scale)); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em;
  color: inherit; opacity: 1; text-wrap: balance;
}
#links :not(.link-map) > figcaption { font-size: calc(var(--t-cap) * var(--t-scale)); font-weight: 700; letter-spacing: -0.01em; }
#links .links-head.big { font-size: calc(var(--t-head) * var(--t-scale) * 1.45); }

#links[data-font="grotesk"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Space Grotesk", system-ui, sans-serif; font-style: normal; font-weight: 700; letter-spacing: -0.02em; }
#links[data-font="rounded"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Nunito", ui-rounded, system-ui, sans-serif; font-style: normal; font-weight: 800; letter-spacing: -0.01em; }
#links[data-font="editorial"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Fraunces", "Iowan Old Style", Georgia, serif; font-style: italic; font-weight: 600; letter-spacing: -0.015em; }
#links[data-font="playfair"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Playfair Display", Georgia, serif; font-style: normal; font-weight: 700; letter-spacing: -0.01em; }
#links[data-font="instrument"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Instrument Serif", Georgia, serif; font-style: normal; font-weight: 400; letter-spacing: 0; }
#links[data-font="poster"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Anton", Impact, "Arial Narrow", sans-serif; font-style: normal; font-weight: 400; letter-spacing: 0.01em; text-transform: uppercase; line-height: 1.02; }
#links[data-font="bebas"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Bebas Neue", Impact, "Arial Narrow", sans-serif; font-style: normal; font-weight: 400; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1; }
#links[data-font="oswald"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Oswald", "Arial Narrow", sans-serif; font-style: normal; font-weight: 600; letter-spacing: 0.01em; text-transform: uppercase; line-height: 1.1; }
#links[data-font="mono"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Space Mono", ui-monospace, Menlo, monospace; font-style: normal; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.2; }
#links[data-font="plex"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-style: normal; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1.2; }
#links[data-font="courier"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Courier Prime", "Courier New", monospace; font-style: normal; font-weight: 700; letter-spacing: 0; line-height: 1.2; }
#links[data-font="script"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Caveat", "Bradley Hand", cursive; font-style: normal; font-weight: 700; letter-spacing: 0; line-height: 1; }
#links[data-font="dancing"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Dancing Script", "Brush Script MT", cursive; font-style: normal; font-weight: 700; letter-spacing: 0; line-height: 1.05; }
#links[data-font="pacifico"] :is(.links-head, :not(.link-map) > figcaption) { font-family: "Pacifico", "Brush Script MT", cursive; font-style: normal; font-weight: 400; letter-spacing: 0; line-height: 1.25; }

/* Gradient: brand blue to violet, or warm white on a Links background. */
#links[data-color="gradient"] :is(.links-head, :not(.link-map) > figcaption) {
  width: fit-content; max-width: 100%;
  background: linear-gradient(95deg, var(--ring-a), var(--ring-b)); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
#links[data-color="gradient"][data-theme]:not([data-theme=""]) :is(.links-head, :not(.link-map) > figcaption) { background-image: linear-gradient(95deg, #fff, #ffd3ec 55%, #ffe8b8); }
@media (max-width: 767px) { #links[data-color="gradient"] :is(.links-head, :not(.link-map) > figcaption) { margin-left: auto; margin-right: auto; } }
html.lb-on #links[data-color="gradient"] :is(.links-head, :not(.link-map) > figcaption) { margin-left: auto; margin-right: auto; }

/* The Text picker in the Edit Links toolbar. */
.lb-text { display: flex; flex-wrap: wrap; gap: 8px; flex-basis: 100%; }
.lb-seg { display: flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface); }
.lb-seg label { position: relative; cursor: pointer; }
.lb-seg input { position: absolute; opacity: 0; pointer-events: none; }
.lb-seg label > span:first-of-type { display: grid; place-items: center; min-width: 36px; height: 32px; padding: 0 9px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); transition: background-color 150ms, color 150ms; }
.lb-seg input:checked + span { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.lb-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.lb-font { font-size: 16px !important; color: var(--text) !important; }
.lb-font[data-font=""] { font-weight: 800 !important; }
.lb-font[data-font="grotesk"] { font-family: "Space Grotesk", system-ui, sans-serif; font-style: normal; font-weight: 700 !important; letter-spacing: -0.02em; font-size: 16px !important; }
.lb-font[data-font="rounded"] { font-family: "Nunito", ui-rounded, system-ui, sans-serif; font-style: normal; font-weight: 800 !important; letter-spacing: -0.01em; font-size: 16px !important; }
.lb-font[data-font="editorial"] { font-family: "Fraunces", "Iowan Old Style", Georgia, serif; font-style: italic; font-weight: 600 !important; letter-spacing: -0.015em; font-size: 16px !important; }
.lb-font[data-font="playfair"] { font-family: "Playfair Display", Georgia, serif; font-style: normal; font-weight: 700 !important; letter-spacing: -0.01em; font-size: 16px !important; }
.lb-font[data-font="instrument"] { font-family: "Instrument Serif", Georgia, serif; font-style: normal; font-weight: 400 !important; letter-spacing: 0; font-size: 19px !important; }
.lb-font[data-font="poster"] { font-family: "Anton", Impact, "Arial Narrow", sans-serif; font-style: normal; font-weight: 400 !important; letter-spacing: 0.01em; text-transform: uppercase; font-size: 15px !important; }
.lb-font[data-font="bebas"] { font-family: "Bebas Neue", Impact, "Arial Narrow", sans-serif; font-style: normal; font-weight: 400 !important; letter-spacing: 0.02em; text-transform: uppercase; font-size: 18px !important; }
.lb-font[data-font="oswald"] { font-family: "Oswald", "Arial Narrow", sans-serif; font-style: normal; font-weight: 600 !important; letter-spacing: 0.01em; text-transform: uppercase; font-size: 15px !important; }
.lb-font[data-font="mono"] { font-family: "Space Mono", ui-monospace, Menlo, monospace; font-style: normal; font-weight: 700 !important; letter-spacing: 0.04em; text-transform: uppercase; font-size: 14px !important; }
.lb-font[data-font="plex"] { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-style: normal; font-weight: 700 !important; letter-spacing: 0.02em; text-transform: uppercase; font-size: 14px !important; }
.lb-font[data-font="courier"] { font-family: "Courier Prime", "Courier New", monospace; font-style: normal; font-weight: 700 !important; letter-spacing: 0; font-size: 16px !important; }
.lb-font[data-font="script"] { font-family: "Caveat", "Bradley Hand", cursive; font-style: normal; font-weight: 700 !important; letter-spacing: 0; font-size: 20px !important; }
.lb-font[data-font="dancing"] { font-family: "Dancing Script", "Brush Script MT", cursive; font-style: normal; font-weight: 700 !important; letter-spacing: 0; font-size: 19px !important; }
.lb-font[data-font="pacifico"] { font-family: "Pacifico", "Brush Script MT", cursive; font-style: normal; font-weight: 400 !important; letter-spacing: 0; font-size: 15px !important; }
.lb-grad { font-weight: 800; background: linear-gradient(95deg, var(--ring-a), var(--ring-b)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Page Style: one folded row on phones, always open in the studio. */
.lb-style { flex: 1 1 100%; min-width: 0; border-radius: 14px; background: var(--surface); }
.lb-style > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.lb-style > summary::-webkit-details-marker { display: none; }
.lb-style > summary .lb-sw { width: 24px; height: 24px; flex: none; }
.lb-style > summary [data-style-sw] { display: grid; place-items: center; color: var(--text); }
.lb-style > summary [data-style-sw] .i { width: 14px; height: 14px; }
.lb-style > summary b { font-size: 14px; }
.lb-style > summary small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.lb-style > summary .i { width: 18px; height: 18px; color: var(--muted); transition: transform 200ms var(--ease); }
.lb-style[open] > summary .i { transform: rotate(180deg); }
.lb-style-body { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 4px 12px 14px; }
.lb-style-body .lb-themes { flex: 1 1 100%; }
.lbs-style .lb-style { background: none; }
.lbs-style .lb-style > summary { display: none; }
.lbs-style .lb-style-body { padding: 0; }
html.lb-studio .links { max-width: none; margin: 0; padding: 0; background: none; }

/* ---------- Create menu (plus button) and quick note window, shared with the dashboard ---------- */
dialog.jb-sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(560px, 100%); max-width: none; max-height: 90dvh;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); border: 0; border-radius: 20px 20px 0 0;
  background: var(--bg); color: var(--text); box-shadow: var(--elev); font-family: var(--font);
  animation: jb-up 260ms var(--ease);
}
dialog.jb-sheet::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 6px; }
dialog.jb-sheet::backdrop { background: rgb(0 0 0 / 0.4); animation: jb-fade 200ms ease-out; }
dialog.jb-sheet.closing { animation: jb-down 160ms ease-in forwards; }
dialog.jb-sheet.closing::backdrop { opacity: 0; transition: opacity 160ms; }
@keyframes jb-up { from { transform: translateY(100%); } }
@keyframes jb-down { to { transform: translateY(100%); } }
@keyframes jb-fade { from { opacity: 0; } }
@keyframes jb-pop { from { opacity: 0; transform: scale(0.96); } }
@keyframes jb-unpop { to { opacity: 0; transform: scale(0.96); } }
.jb-sheet-title { margin: 6px 0 10px; text-align: center; font-weight: 700; font-size: 16px; }
.cm-list { display: grid; gap: 2px; }
.cm-item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 10px; border: 0; border-radius: 12px;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.cm-item:hover, .cm-item:focus-visible { background: var(--surface); outline: none; }
.cm-ic { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); }
.cm-ic .i { width: 22px; height: 22px; }
.cm-t { display: grid; gap: 2px; }
.cm-t strong { font-size: 15px; }
.cm-t small { color: var(--muted); font-size: 13px; }
/* Big screens: a small menu beside the plus button */
dialog.jb-sheet.pop {
  inset: auto; width: 280px; padding: 8px; border-radius: 16px; transform-origin: top left; animation: jb-pop 180ms var(--ease);
}
dialog.jb-sheet.pop::before, dialog.jb-sheet.pop .jb-sheet-title { display: none; }
dialog.jb-sheet.pop::backdrop { background: transparent; }
dialog.jb-sheet.pop.closing { animation: jb-unpop 120ms ease-in forwards; }
.pop .cm-ic { width: 38px; height: 38px; }
/* Note window: near the top so the phone keyboard never covers it */
dialog.note-sheet { inset: max(12px, env(safe-area-inset-top)) 0 auto 0; border-radius: 20px; width: min(440px, calc(100% - 24px)); padding: 4px 16px 18px; animation: jb-pop 200ms var(--ease); }
dialog.note-sheet::before { display: none; }
dialog.note-sheet.closing { animation: jb-unpop 140ms ease-in forwards; }
@media (min-width: 768px) { dialog.note-sheet { inset: 18vh 0 auto 0; } }
.ns-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.ns-head .jb-sheet-title { margin: 10px 0; }
.ns-btn { justify-self: start; padding: 10px 0; border: 0; background: none; color: var(--text); font: inherit; font-size: 15px; cursor: pointer; }
.ns-share { justify-self: end; color: var(--accent); font-weight: 700; }
.ns-share:disabled { opacity: 0.35; cursor: default; }
.ns-bubble { display: flex; justify-content: center; margin: 10px 0 14px; }
.ns-bubble p {
  position: relative; max-width: 80%; margin: 0; padding: 10px 16px; border-radius: 20px; background: var(--surface);
  font-size: 15px; text-align: center; overflow-wrap: anywhere; box-shadow: 0 2px 8px rgb(0 0 0 / 0.06);
}
.ns-bubble p::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); transform: translateX(-60%); }
.ns-bubble p.ph { color: var(--muted); }
.ns-field { position: relative; display: block; }
.ns-field input {
  width: 100%; box-sizing: border-box; padding: 12px 64px 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
}
.ns-field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.ns-field small { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; }
.ns-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ns-hint { margin: 10px 2px 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.ns-delete { display: block; margin: 14px auto 0; padding: 8px 12px; border: 0; background: none; color: var(--like); font: inherit; font-weight: 600; cursor: pointer; }
.ns-err { margin: 10px 2px 0; color: var(--like); font-size: 13px; }
.ns-form.busy { opacity: 0.6; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { dialog.jb-sheet, dialog.jb-sheet::backdrop { animation: none !important; } }
dialog.jb-sheet:focus { outline: none; }

/* ---------- Profile background (like Instagram's profile rings) ----------
   html[data-pbg=light|dark] plus --pbg-a / --pbg-b, set from the profile by profile-bg.js.
   Phones and iPad: the profile card takes the color. Wide screens: the whole profile column. */
html[data-pbg] .profile {
  background: var(--pbg-fill, linear-gradient(160deg, var(--pbg-a), var(--pbg-b))) !important;
  border-radius: 20px; padding-bottom: 16px; position: relative; isolation: isolate;
}
html[data-pbg]:not(.studio) .profile { margin-top: 8px; padding-top: 18px; }
html[data-pbg="light"] .profile {
  --text: #17130f; --muted: rgb(23 19 15 / 0.66); --border: rgb(23 19 15 / 0.12);
  --surface: rgb(255 255 255 / 0.42); --surface-hover: rgb(255 255 255 / 0.6);
  --accent: #3346f0; --accent-text: #fff;
  color: var(--text);
}
html[data-pbg="dark"] .profile {
  --text: #fff; --muted: rgb(255 255 255 / 0.74); --border: rgb(255 255 255 / 0.18);
  --surface: rgb(255 255 255 / 0.14); --surface-hover: rgb(255 255 255 / 0.24);
  --accent: #fff; --accent-text: #111;
  color: var(--text);
}
html[data-pbg] .profile .btn:not(.primary) { background: var(--surface) !important; color: var(--text); backdrop-filter: blur(6px); }
html[data-pbg] .profile .btn:not(.primary):hover { background: var(--surface-hover) !important; }
html[data-pbg="light"] .note-in, html[data-pbg="light"] .note-in::before, html[data-pbg="light"] .note-in::after { background: rgb(255 255 255 / 0.9); color: #17130f; }
html[data-pbg="dark"] .note-in, html[data-pbg="dark"] .note-in::before, html[data-pbg="dark"] .note-in::after { background: rgb(0 0 0 / 0.42); color: #fff; }
@media (min-width: 1000px) {
  html.studio[data-pbg] .side-col { background: var(--pbg-col-fill, linear-gradient(170deg, var(--pbg-a), var(--pbg-b))); border-right-color: transparent; }
  html.studio[data-pbg] .profile { background: none !important; border-radius: 0; padding-bottom: 0; }
  html.studio[data-pbg] .side-col .hl-label { color: var(--text); }
}

/* Message dialog (visitor's Message button) */
.msg-form { text-align: left; }
.msg-form h2, .msg-form > p { text-align: center; }
.msg-form input:not(.hp), .msg-form textarea {
  width: 100%; box-sizing: border-box; padding: 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
}
.msg-form textarea { resize: none; min-height: 110px; padding-bottom: 26px; line-height: 1.4; }
.msg-form input:focus, .msg-form textarea:focus { outline: none; border-color: var(--accent); }
.msg-box { position: relative; }
.msg-box small { position: absolute; right: 12px; bottom: 9px; color: var(--muted); font-size: 12px; }
.msg-form .sub-msg { color: var(--like); text-align: center; }
.msg-form .sub-msg:empty { display: none; }
/* Phones: keep it near the top so the keyboard doesn't cover it */
@media (max-width: 767px) { dialog.msg-dialog { margin-top: max(16px, env(safe-area-inset-top)); } }

/* The Follow button stays blue (studio cards give other buttons the page color). */
html.studio .profile .btn.primary, html[data-pbg] .profile .btn.primary { background: var(--accent) !important; color: var(--accent-text); }
html.studio .profile .btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)) !important; }

/* Full-page tint: with a profile background, the whole page takes a soft version of its color
   (light mode: mixed into white; dark mode: mixed into black). */
:root[data-pbg] {
  --bg: color-mix(in srgb, var(--pbg-b) 26%, #fff);
  --surface: color-mix(in srgb, var(--pbg-a) 20%, #fff);
  --surface-hover: color-mix(in srgb, var(--pbg-a) 32%, #fff);
  --border: color-mix(in srgb, var(--pbg-a) 28%, #fff);
}
@media (prefers-color-scheme: dark) {
  :root[data-pbg]:not([data-theme="light"]) {
    --bg: color-mix(in srgb, var(--pbg-a) 30%, #000);
    --surface: color-mix(in srgb, var(--pbg-a) 40%, #111);
    --surface-hover: color-mix(in srgb, var(--pbg-a) 50%, #111);
    --border: color-mix(in srgb, var(--pbg-a) 45%, #111);
  }
}
:root[data-pbg][data-theme="dark"] {
  --bg: color-mix(in srgb, var(--pbg-a) 30%, #000);
  --surface: color-mix(in srgb, var(--pbg-a) 40%, #111);
  --surface-hover: color-mix(in srgb, var(--pbg-a) 50%, #111);
  --border: color-mix(in srgb, var(--pbg-a) 45%, #111);
}
html[data-pbg] .profile .bio-links a { color: var(--text); }

/* Wide screens: the colored profile column gets the same readable text as the card. (On phones the
   column is display: contents, so these must not apply there, or they'd reach the highlights.) */
@media (min-width: 1000px) {
  html.studio[data-pbg="light"] .side-col {
    --text: #17130f; --muted: rgb(23 19 15 / 0.66); --border: rgb(23 19 15 / 0.12);
    --surface: rgb(255 255 255 / 0.42); --surface-hover: rgb(255 255 255 / 0.6);
    color: var(--text);
  }
  html.studio[data-pbg="dark"] .side-col {
    --text: #fff; --muted: rgb(255 255 255 / 0.74); --border: rgb(255 255 255 / 0.18);
    --surface: rgb(255 255 255 / 0.14); --surface-hover: rgb(255 255 255 / 0.24);
    color: var(--text);
  }
}

/* Film grain over the profile color or photo (data-grain on <html>). */
:root { --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
html[data-grain] .profile::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: var(--grain); opacity: 0.32; mix-blend-mode: overlay;
}
@media (min-width: 1000px) {
  html.studio[data-grain] .profile::after { display: none; }
  html.studio[data-grain] .side-col { isolation: isolate; }
  html.studio[data-grain] .side-col::after {
    content: ""; position: fixed; top: 0; bottom: 0; left: var(--rail); width: 340px; z-index: -1; pointer-events: none;
    background: var(--grain); opacity: 0.32; mix-blend-mode: overlay;
  }
}
.topbar-verified { width: 18px; height: 18px; margin-left: 5px; color: var(--accent); flex: none; }

/* Switching between the site and the dashboard: a short crossfade instead of a white flash. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ---------- Customize Page (dashboard Settings > Customize Page) ---------- */
/* Name font and size: the username heading and the display name. The font list lives in fonts.js. */
html[data-name-font] :is(.profile .username > [data-username], .display-name) { letter-spacing: 0; }
html[data-name-font="grotesk"] :is(.profile .username > [data-username], .display-name) { font-family: "Space Grotesk", system-ui, sans-serif; font-style: normal; font-weight: 700; letter-spacing: -0.02em; }
html[data-name-font="rounded"] :is(.profile .username > [data-username], .display-name) { font-family: "Nunito", ui-rounded, system-ui, sans-serif; font-style: normal; font-weight: 800; letter-spacing: -0.01em; font-size: 1.02em; }
html[data-name-font="editorial"] :is(.profile .username > [data-username], .display-name) { font-family: "Fraunces", "Iowan Old Style", Georgia, serif; font-style: italic; font-weight: 600; letter-spacing: -0.015em; }
html[data-name-font="playfair"] :is(.profile .username > [data-username], .display-name) { font-family: "Playfair Display", Georgia, serif; font-style: normal; font-weight: 700; letter-spacing: -0.01em; font-size: 1.02em; }
html[data-name-font="instrument"] :is(.profile .username > [data-username], .display-name) { font-family: "Instrument Serif", Georgia, serif; font-style: normal; font-weight: 400; letter-spacing: 0; font-size: 1.15em; }
html[data-name-font="poster"] :is(.profile .username > [data-username], .display-name) { font-family: "Anton", Impact, "Arial Narrow", sans-serif; font-style: normal; font-weight: 400; letter-spacing: 0.01em; text-transform: uppercase; font-size: 1.05em; }
html[data-name-font="bebas"] :is(.profile .username > [data-username], .display-name) { font-family: "Bebas Neue", Impact, "Arial Narrow", sans-serif; font-style: normal; font-weight: 400; letter-spacing: 0.02em; text-transform: uppercase; font-size: 1.18em; }
html[data-name-font="oswald"] :is(.profile .username > [data-username], .display-name) { font-family: "Oswald", "Arial Narrow", sans-serif; font-style: normal; font-weight: 600; letter-spacing: 0.01em; text-transform: uppercase; }
html[data-name-font="mono"] :is(.profile .username > [data-username], .display-name) { font-family: "Space Mono", ui-monospace, Menlo, monospace; font-style: normal; font-weight: 700; letter-spacing: 0.04em; }
html[data-name-font="plex"] :is(.profile .username > [data-username], .display-name) { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-style: normal; font-weight: 700; letter-spacing: 0.02em; }
html[data-name-font="courier"] :is(.profile .username > [data-username], .display-name) { font-family: "Courier Prime", "Courier New", monospace; font-style: normal; font-weight: 700; letter-spacing: 0; }
html[data-name-font="script"] :is(.profile .username > [data-username], .display-name) { font-family: "Caveat", "Bradley Hand", cursive; font-style: normal; font-weight: 700; letter-spacing: 0; font-size: 1.3em; }
html[data-name-font="dancing"] :is(.profile .username > [data-username], .display-name) { font-family: "Dancing Script", "Brush Script MT", cursive; font-style: normal; font-weight: 700; letter-spacing: 0; font-size: 1.2em; }
html[data-name-font="pacifico"] :is(.profile .username > [data-username], .display-name) { font-family: "Pacifico", "Brush Script MT", cursive; font-style: normal; font-weight: 400; letter-spacing: 0; }
html[data-name-size="l"] .profile .username { font-size: 26px; }
html[data-name-size="l"] .display-name { font-size: 19px; }
html[data-name-size="xl"] .profile .username { font-size: 34px; line-height: 1.1; }
html[data-name-size="xl"] .display-name { font-size: 24px; line-height: 1.15; }
@media (min-width: 768px) {
  html.studio[data-name-size="l"] .username { font-size: 30px; }
  html.studio[data-name-size="xl"] .username { font-size: 40px; }
  html[data-name-size] .display-name { margin-top: 10px; }
}
/* Bio font. */
html[data-bio-font="grotesk"] .bio { font-family: "Space Grotesk", system-ui, sans-serif; font-style: normal; font-weight: 400; letter-spacing: -0.02em; }
html[data-bio-font="rounded"] .bio { font-family: "Nunito", ui-rounded, system-ui, sans-serif; font-style: normal; font-weight: 500; letter-spacing: -0.01em; font-size: 1.02em; }
html[data-bio-font="editorial"] .bio { font-family: "Fraunces", "Iowan Old Style", Georgia, serif; font-style: italic; font-weight: 400; letter-spacing: -0.015em; font-size: 1.02em; }
html[data-bio-font="playfair"] .bio { font-family: "Playfair Display", Georgia, serif; font-style: normal; font-weight: 400; letter-spacing: -0.01em; font-size: 1.02em; }
html[data-bio-font="instrument"] .bio { font-family: "Instrument Serif", Georgia, serif; font-style: normal; font-weight: 400; letter-spacing: 0; font-size: 1.12em; }
html[data-bio-font="poster"] .bio { font-family: "Anton", Impact, "Arial Narrow", sans-serif; font-style: normal; font-weight: 400; letter-spacing: 0.01em; }
html[data-bio-font="bebas"] .bio { font-family: "Bebas Neue", Impact, "Arial Narrow", sans-serif; font-style: normal; font-weight: 400; letter-spacing: 0.02em; font-size: 1.12em; }
html[data-bio-font="oswald"] .bio { font-family: "Oswald", "Arial Narrow", sans-serif; font-style: normal; font-weight: 400; letter-spacing: 0.01em; }
html[data-bio-font="mono"] .bio { font-family: "Space Mono", ui-monospace, Menlo, monospace; font-style: normal; font-weight: 400; letter-spacing: 0.04em; font-size: 0.92em; }
html[data-bio-font="plex"] .bio { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-style: normal; font-weight: 400; letter-spacing: 0.02em; font-size: 0.94em; }
html[data-bio-font="courier"] .bio { font-family: "Courier Prime", "Courier New", monospace; font-style: normal; font-weight: 400; letter-spacing: 0; font-size: 1.02em; }
html[data-bio-font="script"] .bio { font-family: "Caveat", "Bradley Hand", cursive; font-style: normal; font-weight: 500; letter-spacing: 0; font-size: 1.25em; }
html[data-bio-font="dancing"] .bio { font-family: "Dancing Script", "Brush Script MT", cursive; font-style: normal; font-weight: 500; letter-spacing: 0; font-size: 1.15em; }
html[data-bio-font="pacifico"] .bio { font-family: "Pacifico", "Brush Script MT", cursive; font-style: normal; font-weight: 400; letter-spacing: 0; }
/* Stats row hidden. */
html[data-stats="off"] .profile .stats { display: none; }

/* ---------- Site themes (Customize Page > Theme) ----------
   data-site="darkroom|block|riso" on <html>, with --st-l-* (light) and --st-d-* (dark) colors set by
   site-themes.js. A theme also turns on the profile background layout (data-pbg) for the profile
   column, so these rules are written to win over the profile-background ones. Grain is always on. */
:root[data-site][data-site][data-site] {
  --st-col: light-dark(var(--st-l-col), var(--st-d-col));
  --bg: light-dark(var(--st-l-bg), var(--st-d-bg));
  --surface: light-dark(var(--st-l-surface), var(--st-d-surface));
  --surface-hover: light-dark(var(--st-l-hover), var(--st-d-hover));
  --border: light-dark(var(--st-l-border), var(--st-d-border));
  --text: light-dark(var(--st-l-text), var(--st-d-text));
  --muted: light-dark(var(--st-l-muted), var(--st-d-muted));
  --accent: light-dark(var(--st-l-acc), var(--st-d-acc));
  --accent-text: light-dark(var(--st-l-acc-text), var(--st-d-acc-text));
  --ring-a: light-dark(var(--st-l-ring-a), var(--st-d-ring-a));
  --ring-b: light-dark(var(--st-l-ring-b), var(--st-d-ring-b));
  --st-grain: 0.3;
  --st-grain-blend: multiply;
}
html[data-site][data-pbg] .profile,
html.studio[data-site][data-pbg] .side-col {
  --text: light-dark(var(--st-l-col-text), var(--st-d-col-text));
  --muted: light-dark(var(--st-l-col-muted), var(--st-d-col-muted));
  --border: color-mix(in srgb, var(--text) 16%, transparent);
  --surface: light-dark(var(--st-l-col-surface), var(--st-d-col-surface));
  --surface-hover: color-mix(in srgb, var(--surface) 80%, var(--text) 10%);
  --accent: light-dark(var(--st-l-col-acc), var(--st-d-col-acc));
  --accent-text: light-dark(var(--st-l-col-acc-text), var(--st-d-col-acc-text));
  color: var(--text);
}
html[data-site][data-pbg] .profile .btn.primary { background: var(--accent) !important; color: var(--accent-text); }
html[data-site] .note-in, html[data-site] .note-in::before, html[data-site] .note-in::after { background: var(--bg); color: var(--text); }
/* Grain across the whole page, under the photos. */
html[data-site] body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--st-grain-img); opacity: var(--st-grain); mix-blend-mode: var(--st-grain-blend);
}
:root { --st-grain-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
:root[data-site="block"][data-site][data-site] { --st-grain: 0.34; }
:root[data-site="riso"][data-site][data-site] { --st-grain: 0.42; }
@media (prefers-color-scheme: dark) {
  :root[data-site]:not([data-theme="light"]) { --st-grain-blend: screen; }
  :root[data-site]:not([data-theme="light"]) body::before { opacity: calc(var(--st-grain) * 0.4); }
}
:root[data-site][data-theme="dark"] { --st-grain-blend: screen; }
:root[data-site][data-theme="dark"] body::before { opacity: calc(var(--st-grain) * 0.4); }
/* The profile color gets heavier grain: strongest on Color Block's slab. */
html[data-site] .profile::after { opacity: 0.4; }
html[data-site="block"] .profile::after { opacity: 0.6; }
@media (min-width: 1000px) {
  html.studio[data-site] .side-col::after { opacity: 0.4; }
  html.studio[data-site="block"] .side-col::after { opacity: 0.6; }
  /* Riso: the column is the paper, ruled off with a line of ink. */
  html.studio[data-site="riso"] .side-col { border-right: 1.5px solid var(--border); }
}
html[data-site="riso"]:not(.studio) .profile { outline: 1.5px solid var(--border); outline-offset: -1.5px; }
/* Riso: the name prints slightly off register, and buttons carry the second ink's shadow. */
html[data-site="riso"] :is(.profile .username > [data-username], .display-name) { text-shadow: 1.5px 1px 0 color-mix(in srgb, light-dark(var(--st-l-misreg), var(--st-d-misreg)) 75%, transparent); }
html[data-site="riso"] .profile .btn.primary { box-shadow: 2px 2px 0 light-dark(var(--st-l-shadow), var(--st-d-shadow)); }

/* Sticky tab bar on big screens: runs from the profile column to the window edge (no strip of page
   showing past its ends), and with a site theme it carries the same grain as the page, lined up
   with it, so it doesn't read as a flat, lighter box. */
@media (min-width: 1000px) {
  html.studio .tabs {
    margin-left: calc(-1 * clamp(24px, 3vw, 48px)); padding-left: clamp(24px, 3vw, 48px);
    margin-right: calc(-1 * clamp(20px, 3vw, 40px)); padding-right: clamp(20px, 3vw, 40px);
  }
}
/* Bars that stay put over the page (top and bottom bars, pinned tabs and the Words year headings)
   have a solid background, which would hide the page's grain and show up
   as flat, lighter boxes. With a site theme they draw the same grain, lined up with the page's. */
html[data-site] :is(.topbar, .bottombar, .tabs, .jr-y) { isolation: isolate; }
html[data-site] :is(.topbar, .bottombar, .tabs, .jr-y)::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--st-grain-img); background-attachment: fixed;
  opacity: var(--st-grain); mix-blend-mode: var(--st-grain-blend);
}
/* Only where they actually have a background: on bigger screens the tabs (outside Studio) and the
   year headings are see-through, and grain on them would double up. */
@media (min-width: 768px) {
  html[data-site] .jr-y::before, html[data-site]:not(.studio) .tabs::before { content: none; }
}
@media (min-width: 768px) and (max-width: 999px) {
  html[data-site] .tabs::before { content: none; }
}
@media (prefers-color-scheme: dark) {
  :root[data-site]:not([data-theme="light"]) :is(.topbar, .bottombar, .tabs, .jr-y)::before { opacity: calc(var(--st-grain) * 0.4); }
}
:root[data-site][data-theme="dark"] :is(.topbar, .bottombar, .tabs, .jr-y)::before { opacity: calc(var(--st-grain) * 0.4); }

/* ---------- Customize Page > Just For Fun (data attributes on <html>, set in app.js LOOK) ---------- */
/* Grain strength for themes. */
:root[data-site][data-grain-level="soft"] body::before { opacity: calc(var(--st-grain) * 0.5); }
:root[data-site][data-grain-level="heavy"] body::before { opacity: min(0.9, calc(var(--st-grain) * 1.7)); }
:root[data-site][data-grain-level="soft"] :is(.topbar, .bottombar, .tabs, .jr-y)::before { opacity: calc(var(--st-grain) * 0.5); }
:root[data-site][data-grain-level="heavy"] :is(.topbar, .bottombar, .tabs, .jr-y)::before { opacity: min(0.9, calc(var(--st-grain) * 1.7)); }
html[data-site][data-grain-level="soft"] :is(.profile, .side-col)::after { opacity: 0.2 !important; }
html[data-site][data-grain-level="heavy"] :is(.profile, .side-col)::after { opacity: 0.75 !important; }
/* Profile photo shape. */
html[data-avatar-shape="squircle"] :is(.avatar, .avatar-ring, .avatar-img, .avatar-bot) { border-radius: 30%; }
html[data-avatar-shape="squircle"] .topbar-avatar { border-radius: 30%; }
html[data-avatar-shape="square"] :is(.avatar, .avatar-ring, .avatar-img, .avatar-bot) { border-radius: 6px; }
html[data-avatar-shape="square"] .topbar-avatar { border-radius: 4px; }
/* Highlights. */
html[data-hl-shape="rounded"] :is(.hl-ring, .hl-img) { border-radius: 22%; }
/* Photos load in: Develop, like a print coming up in the tray, or with no animation at all. */
html[data-reveal="develop"] .grid > li.enter { animation: none; }
html[data-reveal="develop"] .grid > li.enter .tile img:not([data-loading]) { animation: develop 1800ms ease-out backwards; animation-delay: inherit; }
@keyframes develop { from { filter: grayscale(1) brightness(1.7) contrast(0.45) sepia(0.2); } 45% { filter: grayscale(0.6) brightness(1.2) contrast(0.8); } }
html[data-reveal="none"] .grid > li.enter { animation: none; }
html[data-reveal="none"] .tile img { transition: none; }
@media (prefers-reduced-motion: reduce) { html[data-reveal="develop"] .grid > li.enter .tile img { animation: none; } }
/* Tab labels: Auto (icons on phones, icons and words on computers), icons only, or words only. */
html[data-tab-labels="words"] .tab .i { display: none; }
html[data-tab-labels="words"] .tab span { display: inline; }
html[data-tab-labels="icons"] .tab span { display: none !important; }
html.studio[data-tab-labels="icons"] .tab { gap: 0; }

/* Big screens: the footer sits at the bottom of the window even when there are only a few posts,
   with the "every post so far" bot just above it, instead of both floating under the grid. */
@media (min-width: 1000px) {
  html.studio .page { grid-template-rows: auto 1fr auto; min-height: 100vh; min-height: 100dvh; }
  html.studio .side-col { grid-row: 1 / 4; }
  html.studio .tabs { grid-row: 1; }
  html.studio .panel { grid-row: 2; }
  html.studio .foot { grid-row: 3; }
  html.studio #panel-posts:not([hidden]) { align-self: stretch; display: flex; flex-direction: column; }
  html.studio #panel-posts .caught-up { margin-top: auto; padding-top: 40px; }
}
/* Big screens, no posts yet: the empty-state bot sits in the middle of the open space, not at the top. */
@media (min-width: 1000px) {
  html.studio #panel-posts #grid:has(> .empty) { flex: 1; display: grid; place-items: center; padding-bottom: 48px; }
}

/* iPad Home Screen app: the status bar floats over the page and blurs whatever passes under it. A solid
   strip in the page color sits under it, and everything starts below it. */
html.pwa-wide { --sb: env(safe-area-inset-top, 0px); }
html.pwa-wide::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; z-index: 2147483000; height: var(--sb);
  background: var(--bg); pointer-events: none;
}
html.pwa-wide body { padding-top: var(--sb); }
html.pwa-wide .rail { top: var(--sb); }
html.pwa-wide.studio .side-col, html.pwa-wide.studio .tabs { top: var(--sb); }
html.pwa-wide.studio .side-col { height: calc(100dvh - var(--sb)); }
@media (min-width: 1000px) and (orientation: landscape), (min-width: 1100px) {
  html.pwa-wide.studio .post-dialog { top: var(--sb); height: calc(100% - var(--sb)); padding-top: 0; }
}
