/* ============================================================
   Articles demo. The tokens and the shell come from app-builder and
   group-structure, which measured them on welley.social (theme-navy).
   The portal styles read --p-* variables that the blog settings set.
   ============================================================ */
:root {
  --bg-main: #f1f3f6;
  --bg-primary: #ffffff;
  --bg-secondary: #f1f3f6;
  --bg-secondary-hover: #e4e7ed;
  --bg-tertiary: #f8f9fb;
  --brand: #2259f0;
  --brand-hover: #1c4ace;
  --brand-soft: #ecf0fe;
  --badge-bg: #d9e2fd;
  --badge-text: #13318c;
  --t1: #1d2236;
  --t2: #434c63;
  --t3: #7b859e;
  --t4: #a5adc0;
  --border: #e4e7ed;
  --border-strong: #cfd4de;
  --error: #f04438;
  --error-soft: #fef3f2;
  --ok: #558402;
  --ok-soft: #f4fcea;
  --warn: #b36d05;
  --warn-soft: #fff9ec;
  --r-sm: 8px;
  --r-m: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --shadow-pop: 0 8px 28px rgba(29, 34, 54, 0.16);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg-main);
  color: var(--t1);
  font-size: 14px;
  line-height: 20px;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; text-align: inherit; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
svg { display: block; flex-shrink: 0; }
ol, ul { list-style: none; }
.spacer { flex: 1; }
.muted { color: var(--t3); }
.small { font-size: 12px; line-height: 16px; }
.dot-sep { color: var(--t4); }

/* ---------- demo bar and address bar (scaffolding) ---------- */
.demo-bar {
  flex: 0 0 auto; min-height: 52px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 8px 16px; border-bottom: 1px dashed var(--border-strong);
}
.demo-brand { display: flex; align-items: center; gap: 10px; }
.brand-title { font-weight: 600; font-size: 15px; }
.brand-tag {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  color: var(--t3); background: var(--bg-secondary-hover); padding: 2px 8px; border-radius: 999px;
}
.demo-controls { display: flex; align-items: center; gap: 12px; }
.seg { display: inline-flex; align-items: center; background: var(--bg-secondary-hover); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  height: 28px; padding: 0 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--t2);
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button.on { background: var(--bg-primary); color: var(--t1); box-shadow: 0 1px 2px rgba(29, 34, 54, .1); }
.seg-label { font-size: 12px; color: var(--t3); padding: 0 6px 0 4px; }

.address {
  flex: 0 0 auto; height: 34px; margin: 10px 16px 0;
  display: flex; align-items: center; gap: 6px; padding: 0 14px;
  background: var(--bg-primary); border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; color: var(--t3); overflow: hidden; white-space: nowrap;
}
.addr-url { color: var(--t2); overflow: hidden; text-overflow: ellipsis; }
.addr-host { color: var(--t1); font-weight: 500; }

/* ---------- avatars ---------- */
.av {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px;
}
.av.xs { width: 18px; height: 18px; font-size: 10px; }
.av.sm { width: 32px; height: 32px; font-size: 14px; }
.av.xl { width: 112px; height: 112px; font-size: 44px; box-shadow: 0 0 0 4px var(--bg-primary); }

/* ---------- product chrome ---------- */
.app { flex: 1 1 auto; min-height: 0; display: flex; gap: 16px; padding: 16px; }
.app.is-standalone { padding: 12px 0 0; }

.rail {
  flex: 0 0 64px; background: var(--bg-primary); border-radius: var(--r-lg);
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 0;
}
.rail-logo { margin-bottom: 8px; }
.rail-btn {
  width: 40px; height: 40px; border-radius: var(--r-m);
  display: grid; place-items: center; color: var(--t2);
}
.rail-btn:hover { background: var(--bg-secondary); }
.rail-btn.active { background: var(--brand-soft); color: var(--brand); }
.rail-sep { width: 40px; height: 1px; background: var(--border); margin: 4px 0; }
.rail-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px;
}
.rail-avatar.active { box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--brand); }
.rail-avatar.small { width: 32px; height: 32px; font-size: 13px; }
.blurred { filter: blur(1.5px); opacity: .45; pointer-events: none; }

.sidebar {
  flex: 0 0 280px; background: var(--bg-primary); border-radius: var(--r-lg);
  overflow-y: auto; overflow-x: hidden; padding-bottom: 16px;
}
.side-title { font-size: 19px; line-height: 24px; font-weight: 600; padding: 20px 20px 12px; }
.sections { padding: 0 12px; }
.row { display: flex; align-items: center; padding: 8px; margin-bottom: 4px; border-radius: var(--r-m); }
.row.active { background: var(--bg-secondary); }
.row-icon { width: 24px; height: 24px; display: grid; place-items: center; flex-shrink: 0; }
.row-text { margin-left: 12px; min-width: 0; flex: 1; }
.row-title { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic-plain { color: var(--t3); }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; line-height: 16px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--bg-secondary); color: var(--t2); white-space: nowrap;
}
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.vis-ic { display: inline-flex; color: var(--t3); }

/* "Just added" highlight, shown once after a render. */
.flash { animation: flash 2s ease-out; }
@keyframes flash {
  0%, 35% { background-color: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand); }
  100% { box-shadow: 0 0 0 2px transparent; }
}

.content {
  flex: 1 1 auto; min-width: 0; background: var(--bg-primary); border-radius: var(--r-lg);
  overflow-y: auto;
}
.standalone { flex: 1 1 auto; min-width: 0; overflow-y: auto; }
.view-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-primary); z-index: 3;
}
.view-title { font-size: 19px; line-height: 24px; font-weight: 600; }
.view-sub { color: var(--t3); font-size: 13px; }
.note-box {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--r-m);
  padding: 12px 14px; color: var(--t2); font-size: 13px; line-height: 19px;
}
.note-box svg { color: var(--t3); margin-top: 1px; }
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  color: var(--t4); padding: 56px 24px;
}
.empty p { color: var(--t3); max-width: 340px; }

.tabs { display: flex; align-items: center; gap: 22px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 12px 0 10px; font-weight: 600; color: var(--t3); white-space: nowrap;
  border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--t1); }
.tab.active { color: var(--t1); border-bottom-color: var(--t1); }

/* ---------- profile ---------- */
.profile { max-width: 780px; margin: 0 auto; padding: 16px 16px 48px; }
.p-cover { height: 200px; border-radius: var(--r-lg); background: #c7d4fb center / cover; }
.p-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 20px; margin-top: -56px; }
.p-info { padding: 12px 20px 0; }
.p-info h1 { font-size: 22px; line-height: 28px; font-weight: 700; }
.p-bio { margin-top: 10px; color: var(--t2); }
.p-stats { margin-top: 10px; color: var(--t3); }
.p-stats b { color: var(--t1); }
.p-tabs { margin-top: 16px; padding: 0 20px; overflow-x: auto; }
.p-body { padding: 20px; }

.a-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.a-head h2 { font-size: 17px; line-height: 24px; font-weight: 600; }
.chips-row { display: flex; gap: 8px; margin-bottom: 14px; }
.fchip {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  font-weight: 600; font-size: 13px; color: var(--t2);
}
.fchip:hover { border-color: var(--border-strong); }
.fchip.on { background: var(--t1); border-color: var(--t1); color: #fff; }
.fchip .n { opacity: .65; margin-left: 4px; }

.acards { display: flex; flex-direction: column; gap: 10px; }
.acard {
  display: flex; gap: 16px; padding: 14px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-lg);
}
.acard:hover { border-color: var(--border-strong); background: var(--bg-tertiary); }
.thumb { width: 168px; height: 104px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.tile { display: grid; place-items: center; color: #fff; font-family: 'Source Serif 4', Georgia, serif; font-size: 40px; font-weight: 700; }
.acard-text { flex: 1; min-width: 0; }
.acard h3 { font-size: 16px; line-height: 22px; font-weight: 600; }
.acard-ex {
  margin-top: 4px; color: var(--t2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.acard-meta { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--t3); font-size: 13px; }

.menu-wrap { position: relative; align-self: flex-start; }
.menu {
  position: absolute; right: 0; top: 36px; z-index: 10; min-width: 180px;
  background: var(--bg-primary); border-radius: var(--r-m); box-shadow: var(--shadow-pop); padding: 6px;
  display: flex; flex-direction: column;
}
.menu button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); font-weight: 500; white-space: nowrap; }
.menu button:hover { background: var(--bg-secondary); }
.menu button svg { color: var(--t3); }
.menu .danger, .menu .danger svg { color: var(--error); }

.post { display: flex; gap: 12px; padding: 16px 8px; border-bottom: 1px solid var(--border); border-radius: var(--r-m); }
.post-main { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 6px; }
.post-text { margin-top: 2px; white-space: pre-wrap; }
.post-actions { display: flex; gap: 28px; margin-top: 10px; color: var(--t3); font-size: 13px; }
.post-actions span { display: inline-flex; align-items: center; gap: 6px; }
.embed {
  display: block; margin-top: 10px; border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; cursor: pointer; background: var(--bg-primary);
}
.embed:hover { border-color: var(--border-strong); }
.embed img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; display: block; }
.embed-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.embed-label {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--brand);
}
.embed-body b { font-size: 16px; line-height: 22px; }
.embed-body p { color: var(--t2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- article text, shared by the editor and the article page ---------- */
.prose { font-family: var(--p-body); font-size: 18px; line-height: 1.7; color: var(--p-text); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-family: var(--p-head); font-size: 27px; line-height: 1.3; font-weight: 700; margin-top: 1.7em; letter-spacing: -0.01em; }
.prose h3 { font-family: var(--p-head); font-size: 21px; line-height: 1.35; font-weight: 700; margin-top: 1.5em; }
.prose a { color: var(--p-accent); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { font-weight: 650; }
.prose blockquote { border-left: 3px solid var(--p-accent); padding: 2px 0 2px 20px; font-style: italic; }
.prose ul { list-style: disc; padding-left: 1.4em; }
.prose ol { list-style: decimal; padding-left: 1.4em; }
.prose li + li { margin-top: .35em; }
.prose li > p { margin: 0; }
.prose li::marker { color: var(--p-muted); }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; background: var(--p-soft); padding: 2px 5px; border-radius: 5px; }
.prose pre { background: var(--p-soft); border-radius: 10px; padding: 14px 16px; overflow-x: auto; font-size: 14px; line-height: 1.55; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose img { display: block; width: 100%; height: auto; border-radius: 12px; margin-top: 1.6em; margin-bottom: 1.6em; }
.prose hr { border: 0; border-top: 1px solid var(--p-border); margin: 2em 0; }

/* ---------- composer ---------- */
.c-bar {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--bg-primary); border-bottom: 1px solid var(--border);
}
.c-status { display: inline-flex; align-items: center; gap: 7px; color: var(--t3); font-weight: 500; font-size: 13px; }
.c-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--t4); }
.c-status .dot.ok { background: #12b76a; }
.c-status .dot.warn { background: #f79009; }
.c-count { color: var(--t3); font-size: 13px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.c-page { width: 100%; max-width: 760px; margin: 0 auto; padding: 32px 24px 160px; }
.c-header.empty {
  width: 100%; height: 112px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--t3); font-weight: 600;
}
.c-header.empty:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.c-header.has-img { position: relative; }
.c-header img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-lg); display: block; }
.c-header-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.c-header:hover .c-header-actions, .c-header:focus-within .c-header-actions { opacity: 1; }
.c-header-actions .btn { box-shadow: var(--shadow-pop); background: var(--bg-primary); }
.c-title {
  display: block; width: 100%; margin: 28px 0 4px; border: 0; outline: 0; resize: none; overflow: hidden;
  background: transparent; color: var(--t1);
  font-family: var(--p-head); font-size: 42px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em;
}
.c-title::placeholder { color: var(--t4); }
.c-toolbar {
  position: sticky; top: 53px; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 5px; margin: 14px 0 22px; background: var(--bg-primary);
  border: 1px solid var(--border); border-radius: var(--r-m); box-shadow: 0 1px 3px rgba(29, 34, 54, .06);
}
.tb { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--t2); }
.tb:hover { background: var(--bg-secondary); color: var(--t1); }
.tb.on { background: var(--brand-soft); color: var(--brand); }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.editor-host .ProseMirror { min-height: 360px; outline: none; }
.ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder); float: left; height: 0; color: var(--t4); pointer-events: none;
}
.ProseMirror img.ProseMirror-selectednode { outline: 3px solid var(--brand); outline-offset: 2px; }

/* The floating toolbar. It stays hidden until Tiptap takes it over. */
.bubble {
  visibility: hidden; display: flex; gap: 2px; padding: 4px;
  background: #1d2236; border-radius: 10px; box-shadow: var(--shadow-pop);
}
.bubble button { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: #d5d9e4; }
.bubble button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.bubble button.on { color: #8fb0ff; }

/* ---------- portal and article page ---------- */
.portal { min-height: 100%; background: var(--p-bg); color: var(--p-text); font-family: var(--p-body); }
.strip {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px;
  padding: 12px 32px; border-bottom: 1px solid var(--p-border);
  background: color-mix(in srgb, var(--p-bg) 90%, transparent); backdrop-filter: blur(8px);
}
.strip-blog { display: flex; align-items: center; gap: 10px; min-width: 0; }
.strip-name { display: block; font-family: var(--p-head); font-size: 17px; line-height: 22px; font-weight: 700; }
.strip-by { display: block; font-size: 12px; line-height: 16px; color: var(--p-muted); }
.p-btn {
  height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--p-border);
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--p-text); white-space: nowrap;
}
.p-btn:hover { background: var(--p-soft); }
.p-btn.solid { background: var(--p-accent); border-color: var(--p-accent); color: var(--p-on-accent); }
.on-welley {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; padding: 4px 8px;
  border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--p-muted);
}
.on-welley:hover { background: var(--p-soft); }
.p-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--p-muted); }
.p-meta .vis-ic { color: inherit; }
.p-foot { padding: 32px; text-align: center; font-size: 13px; color: var(--p-muted); border-top: 1px solid var(--p-border); }
.p-empty { padding: 48px 0; color: var(--p-muted); font-size: 16px; }
.p-tile {
  display: grid; place-items: center; background: var(--p-accent); color: var(--p-on-accent);
  font-family: var(--p-head); font-size: 64px; font-weight: 700;
}

.ph-head { max-width: 1080px; margin: 0 auto; padding: 56px 32px 28px; }
.ph-head h1 { font-family: var(--p-head); font-size: 52px; line-height: 1.08; font-weight: 700; letter-spacing: -0.025em; }
.ph-head p { margin-top: 12px; max-width: 620px; font-size: 18px; line-height: 1.5; color: var(--p-muted); }
.ph-list { max-width: 1080px; margin: 0 auto; padding: 12px 32px 72px; }

.t-grid, .m-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; }
.m-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-card { display: flex; flex-direction: column; }
.g-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; }
.g-card h3 { font-family: var(--p-head); font-size: 22px; line-height: 1.3; font-weight: 700; margin: 16px 0 8px; }
.g-card p {
  font-size: 15px; line-height: 1.55; color: var(--p-muted); margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.g-card:hover h3, .l-row:hover h3, .m-hero:hover h2, .mn-row:hover .mn-title, .more-card:hover b { color: var(--p-accent); }

/* List and Minimal keep a narrower column, aligned with the blog's title. */
.t-list > * { max-width: 860px; }
.t-minimal > * { max-width: 720px; }
.l-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 32px; align-items: center; padding: 28px 0; border-bottom: 1px solid var(--p-border); }
.l-row:first-child { padding-top: 8px; }
.l-row h3 { font-family: var(--p-head); font-size: 26px; line-height: 1.25; font-weight: 700; margin: 6px 0 8px; }
.l-row p { font-size: 16px; line-height: 1.6; color: var(--p-muted); }
.l-img { width: 220px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; font-size: 48px; }

.m-hero {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 36px; align-items: center;
  padding-bottom: 44px; margin-bottom: 44px; border-bottom: 1px solid var(--p-border);
}
.m-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; font-size: 96px; }
.p-kicker { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--p-accent); }
.m-hero h2 { font-family: var(--p-head); font-size: 38px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; margin: 10px 0 14px; }
.m-hero p { font-size: 17px; line-height: 1.6; color: var(--p-muted); margin-bottom: 14px; }

.mn-year h4 { font-family: var(--p-head); font-size: 15px; font-weight: 700; color: var(--p-muted); margin: 28px 0 6px; }
.mn-year:first-child h4 { margin-top: 0; }
.mn-row { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--p-border); }
.mn-title { display: inline-flex; align-items: center; gap: 8px; font-family: var(--p-head); font-size: 20px; line-height: 1.35; }

.preview-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 32px;
  background: #1d2236; color: #e9ebf1; font-size: 13px;
}
.preview-bar span:not(.spacer) { color: #a5adc0; }

.ar-layout { max-width: 1120px; margin: 0 auto; padding: 44px 32px 72px; display: grid; grid-template-columns: minmax(0, 720px); justify-content: center; }
.ar-layout.with-tl { grid-template-columns: minmax(0, 720px) 240px; gap: 64px; }
.ar { min-width: 0; }
.ar-hero { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-lg); margin-bottom: 36px; display: block; }
.ar-title { font-family: var(--p-head); font-size: 46px; line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; }
.ar-byline { display: flex; align-items: center; gap: 12px; margin: 22px 0 36px; font-size: 15px; }
.ar-byline .p-meta { display: flex; }
.ar-byline .pill { margin-left: auto; background: var(--p-soft); color: var(--p-muted); }
.ar-actions {
  display: flex; align-items: center; gap: 6px; margin-top: 48px; padding: 10px 0;
  border-top: 1px solid var(--p-border); border-bottom: 1px solid var(--p-border);
}
.ar-act {
  height: 38px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px;
  color: var(--p-muted); font-weight: 600;
}
.ar-act:hover { background: var(--p-soft); color: var(--p-text); }
.ar-act.on { color: var(--p-accent); }
.ar-act.on svg { fill: currentColor; }
.ar-act[data-action="repost"].on svg { fill: none; }

.more { margin-top: 56px; }
.more h4, .tl-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--p-muted); }
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 16px; }
.more-card { display: flex; flex-direction: column; gap: 6px; }
.more-img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; font-size: 40px; margin-bottom: 4px; }
.more-card b { font-family: var(--p-head); font-size: 16px; line-height: 1.35; }

.tl { position: sticky; top: 88px; align-self: start; }
.tl-track { margin-top: 14px; border-left: 2px solid var(--p-border); margin-left: 5px; }
.tl-month { padding: 14px 0 8px 18px; font-size: 12px; font-weight: 600; color: var(--p-muted); }
.tl-month:first-child { padding-top: 0; }
.tl-item { position: relative; padding: 0 0 14px 18px; }
.tl-item::before {
  content: ''; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--p-bg); border: 2px solid var(--p-border);
}
.tl-item.current::before { background: var(--p-accent); border-color: var(--p-accent); }
.tl-item a { display: block; font-size: 14px; line-height: 1.4; }
.tl-item a:hover { color: var(--p-accent); }
.tl-item.current a { font-weight: 700; pointer-events: none; }
.tl-item span { display: block; margin-top: 2px; font-size: 12px; color: var(--p-muted); }

.locked { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 96px 24px; color: var(--p-muted); }
.locked h2 { font-family: var(--p-head); font-size: 28px; color: var(--p-text); }

/* ---------- settings ---------- */
.set-layout { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 32px; padding: 20px 24px 40px; align-items: start; }
.set-group { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.set-group.last { border-bottom: 0; }
.set-group h3 { font-size: 15px; line-height: 22px; font-weight: 600; margin-bottom: 12px; }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl, .opt {
  border: 1px solid var(--border); border-radius: var(--r-m); padding: 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.tpl:hover, .opt:hover { border-color: var(--border-strong); }
.tpl.on, .opt.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: #fbfcff; }
.tpl-thumb { height: 64px; border-radius: var(--r-sm); background: var(--bg-secondary); padding: 8px; display: grid; gap: 5px; margin-bottom: 6px; }
.tpl-thumb i { background: var(--border-strong); border-radius: 3px; }
.tt-grid { grid-template-columns: repeat(3, 1fr); }
.tt-list { grid-template-rows: repeat(3, 1fr); }
.tt-list i { background: linear-gradient(90deg, var(--border-strong) 62%, transparent 62%, transparent 70%, var(--t4) 70%); }
.tt-magazine { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.tt-magazine i:first-child { grid-row: span 2; background: var(--t4); }
.tt-minimal { grid-template-rows: repeat(4, 1fr); gap: 6px; padding: 10px 12px; }
.tt-minimal i { height: 3px; align-self: center; }
.tt-minimal i:nth-child(odd) { width: 80%; }
.opt-row { display: flex; gap: 8px; }
.opt { flex: 1; align-items: center; text-align: center; font-weight: 500; color: var(--t2); gap: 6px; }
.aa { font-size: 24px; line-height: 28px; font-weight: 700; color: var(--t1); }
.aa-body { font-size: 13px; }
.bg-sample { width: 100%; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(29, 34, 54, .12); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.sw { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.sw.on { box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--t1); }
.switch-row { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; cursor: pointer; }
.switch-row > span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.switch {
  appearance: none; flex-shrink: 0; width: 36px; height: 20px; margin-top: 2px; border-radius: 999px;
  background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s;
}
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(16px); }
.set-preview { position: sticky; top: 90px; }
.set-preview-head { display: flex; align-items: center; margin-bottom: 10px; }
.mini { height: 640px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-m); background: var(--bg-primary); }
.mini .strip { position: static; }
.mini .tl { position: static; }

/* ---------- controls ---------- */
.btn {
  height: 40px; padding: 0 16px; border-radius: var(--r-m); font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn.small { height: 32px; padding: 0 12px; border-radius: var(--r-sm); font-size: 13px; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.secondary { background: var(--bg-secondary); color: var(--t1); }
.btn.secondary:hover { background: var(--bg-secondary-hover); }
.btn.solid { background: var(--brand); color: #fff; }
.btn.following { background: var(--bg-secondary); color: var(--t1); }
.btn.danger { background: var(--error); color: #fff; }
.btn:disabled { background: var(--bg-secondary); color: var(--t4); }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--t3);
}
.icon-btn:hover { background: var(--bg-secondary); color: var(--t1); }
.input, .textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: var(--r-m);
  background: var(--bg-primary); padding: 0 12px; height: 40px; font-size: 14px; outline: none;
}
.textarea { height: auto; min-height: 64px; padding: 10px 12px; resize: vertical; line-height: 20px; }
.input:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 500; color: var(--t2); }

/* ---------- modal ---------- */
.modal {
  margin: auto; border: 0; border-radius: var(--r-lg); width: min(480px, calc(100vw - 32px));
  box-shadow: var(--shadow-pop); padding: 0; color: var(--t1);
}
.modal.wide { width: min(600px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(241, 243, 246, 0.7); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-head h2 { font-size: 17px; line-height: 24px; font-weight: 600; }
.modal-body { padding: 10px 20px 6px; }
.modal-body > p { color: var(--t2); margin-bottom: 12px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 10px 20px 20px; }
.modal-pad { height: 14px; }

/* The radio buttons are hidden. The selected card shows the choice. */
.vis-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.vis-opt {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-m); cursor: pointer;
}
.vis-opt:hover { border-color: var(--border-strong); }
.vis-opt:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: #fbfcff; }
.vis-opt:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--brand-soft), inset 0 0 0 1px var(--brand); }
.vis-opt input { position: absolute; opacity: 0; pointer-events: none; }
.vis-top { display: flex; align-items: center; gap: 6px; }
.vis-top svg { color: var(--t2); }
.vis-opt:has(input:checked) .vis-top svg { color: var(--brand); }
.slug-input {
  display: flex; align-items: center; height: 40px; padding-left: 12px; overflow: hidden;
  border: 1px solid var(--border-strong); border-radius: var(--r-m);
}
.slug-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.slug-input .muted { white-space: nowrap; font-size: 13px; }
.slug-input input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; padding-right: 12px; }
.announce { border: 1px solid var(--border); border-radius: var(--r-m); padding: 4px 12px 12px; margin-bottom: 14px; }
.announce:not(:has(.switch:checked)) .announce-body { display: none; }
.announce-body { display: flex; flex-direction: column; gap: 10px; }
.mini-post { border: 1px solid var(--border); padding: 12px; }
.mini-post .embed { cursor: default; }
.mini-post .embed img { aspect-ratio: 4 / 1; }
.pick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-height: 380px; overflow-y: auto; padding: 2px; }
.pick { border-radius: var(--r-sm); overflow: hidden; aspect-ratio: 16 / 10; }
.pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick:hover { outline: 2px solid var(--brand); outline-offset: 2px; }
.upload { margin-top: 14px; cursor: pointer; }

/* ---------- toasts ---------- */
.toast-stack {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 60; align-items: center;
}
.toast {
  display: flex; align-items: center; gap: 14px;
  background: #292929; color: #fff; padding: 10px 16px; border-radius: var(--r-m);
  font-size: 14px; box-shadow: var(--shadow-pop); animation: toast-in .2s ease-out;
}
.toast button { color: #8fb0ff; font-weight: 600; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- narrow screens ----------
   The shell stacks and the document itself scrolls. Mobile browsers handle page scrolling
   far more reliably than scrolling inside a fixed-height container. */
@media (max-width: 900px) {
  html, body { height: auto; }
  body { display: block; }
  .app { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-content: start; gap: 12px; padding: 12px; }
  .app.is-standalone { display: block; padding: 12px 0 0; }
  .rail { align-self: start; position: sticky; top: 12px; }
  .settings-side { display: none; }
  .content, .standalone { overflow: visible; }
  .c-toolbar { top: 0; position: static; }
  .c-bar { position: static; }
  .set-layout { grid-template-columns: minmax(0, 1fr); }
  .set-preview { position: static; }
  .mini { height: 460px; }
  .strip { padding: 10px 16px; flex-wrap: wrap; }
  .ph-head { padding: 36px 16px 20px; }
  .ph-head h1 { font-size: 36px; }
  .ph-list { padding: 8px 16px 56px; }
  .t-grid, .m-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
  .m-hero { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .l-row { grid-template-columns: minmax(0, 1fr) 120px; gap: 16px; }
  .l-img { width: 120px; }
  .ar-layout, .ar-layout.with-tl { grid-template-columns: minmax(0, 1fr); gap: 40px; padding: 28px 16px 56px; }
  .tl { position: static; }
  .ar-title { font-size: 34px; }
  .more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-bar { padding: 10px 16px; flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .t-grid, .m-grid, .more-grid { grid-template-columns: minmax(0, 1fr); }
  .thumb { width: 96px; height: 72px; }
  .acard { gap: 12px; padding: 12px; }
  .c-title { font-size: 32px; }
  .c-count { display: none; }
  .pick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .vis-opts { grid-template-columns: minmax(0, 1fr); }
  .p-body { padding: 16px 4px; }
  .profile { padding: 8px 8px 40px; }
}
