/* Heartipedia — system fonts only, zero third-party requests before intent. */
:root {
  --ink: #1b1b1b; --muted: #5a5a5a; --line: #e2e2e2; --bg: #fff; --tint: #f6f6f4;
  --link: #0b57d0; --accent: #b3261e; --max: 44rem;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 6px 10px; z-index: 10; }
header.site, main, footer.site { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }
header.site { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .9rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
header.site .brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 1.15rem; letter-spacing: .01em; }
header.site nav { display: flex; gap: 1rem; align-items: center; font-size: .95rem; }
header.site nav a { text-decoration: none; }
.account img.avatar { border-radius: 50%; vertical-align: middle; margin-right: .35rem; }
.account button { background: none; border: 1px solid var(--line); border-radius: 6px; padding: .3rem .6rem; font: inherit; cursor: pointer; color: var(--ink); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* The avatar menu: a button in the header, a card under it. */
.account-box { position: relative; }
.account .avatar-btn { padding: 2px; border-radius: 50%; border: 1px solid var(--line); line-height: 0; }
.account .avatar-btn:hover { border-color: var(--link); }
.account img.avatar, .account .avatar-initial { margin: 0; }
.account .avatar-initial { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; align-items: center; justify-content: center; background: var(--tint); font-size: .95rem; line-height: 1; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + .4rem); z-index: 20; min-width: 15rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .35rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12); text-align: left;
}
.account-who { padding: .5rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .25rem; display: flex; flex-direction: column; gap: .1rem; }
.account-who strong { font-size: .95rem; }
.account-email { font-size: .85rem; color: var(--muted); word-break: break-all; }
.account-via { font-size: .78rem; color: var(--muted); }
.account-menu a[role="menuitem"], .account-menu button[role="menuitem"] {
  display: block; width: 100%; text-align: left; padding: .45rem .6rem; border: 0; border-radius: 6px;
  background: none; font: inherit; color: var(--ink); text-decoration: none; cursor: pointer;
}
.account-menu a[role="menuitem"]:hover, .account-menu button[role="menuitem"]:hover,
.account-menu a[role="menuitem"]:focus, .account-menu button[role="menuitem"]:focus { background: var(--tint); }
.account-signout { margin: .25rem 0 0; border-top: 1px solid var(--line); padding-top: .25rem; }
.account-notice { margin: .3rem .6rem 0; font-size: .8rem; color: var(--accent); }

/* The subject check: shown only to the person the page is about. */
.subject-check { border: 1px solid var(--link); border-radius: 8px; padding: .9rem 1rem; margin: 1.5rem 0; background: var(--tint); }
.subject-check h2 { margin-top: 0; font-size: 1.1rem; }
.subject-check label { display: block; font-size: .9rem; margin-bottom: .25rem; }
.subject-check textarea { width: 100%; font: inherit; padding: .5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.subject-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0 .3rem; }
.subject-check .button { cursor: pointer; background: var(--link); color: #fff; border-color: var(--link); font: inherit; }
.subject-check .button.secondary { background: var(--bg); color: var(--link); }
.subject-check .button[disabled] { opacity: .6; cursor: progress; }
.subject-current:empty { display: none; }
.subject-current { font-size: .9rem; }
dl.settings > div { display: flex; gap: .6rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
dl.settings dt { min-width: 9rem; color: var(--muted); }
dl.settings dd { margin: 0; }
main { padding-top: 1.5rem; padding-bottom: 3rem; }
footer.site { border-top: 1px solid var(--line); padding-top: 1rem; padding-bottom: 2rem; color: var(--muted); font-size: .85rem; }
h1 { font-size: 2rem; line-height: 1.2; margin: .2rem 0 .6rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 .6rem; }
h3 { font-size: 1.1rem; margin: 1.4rem 0 .4rem; }
p.lead, p.summary { font-size: 1.1rem; color: var(--muted); margin-top: 0; }
.crumbs { font-size: .85rem; color: var(--muted); }
.crumbs a { color: inherit; }
.notice { background: var(--tint); border-left: 3px solid var(--accent); padding: .6rem .8rem; }
.small { font-size: .85rem; color: var(--muted); }
.button { display: inline-block; border: 1px solid var(--link); border-radius: 6px; padding: .45rem .9rem; text-decoration: none; }
button { font: inherit; }

/* mechanism list on the landing */
.mechanism { padding-left: 1.2rem; }
.mechanism li { margin: .5rem 0; }
.page-list { list-style: none; padding: 0; }
.page-list li { padding: .7rem 0; border-top: 1px solid var(--line); }
.page-list li a { font-weight: 600; font-size: 1.05rem; }
.page-list .kind { font-size: .75rem; color: var(--muted); margin-left: .6rem; text-transform: uppercase; letter-spacing: .05em; }
.page-list p { margin: .2rem 0 0; color: var(--muted); }

/* table of contents */
.toc { background: var(--tint); padding: .6rem 1rem; border-radius: 8px; font-size: .95rem; margin: 1rem 0; }
.toc-h { margin: 0 0 .3rem; font-weight: 600; }
.toc ol { margin: 0; padding-left: 1.2rem; }
.toc li.l3 { margin-left: 1rem; list-style: circle; }

/* article body */
.body { max-width: 100%; }
.body p { margin: 0 0 1rem; }
.table-wrap { overflow-x: auto; margin: 1rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--tint); }
.keyfacts { margin: 1rem 0; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .9rem; background: var(--tint); }
.keyfacts div { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem; padding: .3rem 0; border-top: 1px solid var(--line); }
.keyfacts div:first-child { border-top: 0; }
.keyfacts dt { font-weight: 600; }
.keyfacts dd { margin: 0; }
.asof { color: var(--muted); font-size: .85rem; }
.timeline { padding-left: 0; list-style: none; border-left: 2px solid var(--line); margin: 1rem 0 1rem .4rem; }
.timeline li { padding: .2rem 0 .6rem 1rem; }
.timeline time { font-weight: 600; margin-right: .4rem; }
blockquote { margin: 1rem 0; padding: .2rem 1rem; border-left: 3px solid var(--line); color: #333; }
blockquote footer { font-size: .85rem; color: var(--muted); }
sup.ref { font-size: .7em; line-height: 0; }
sup.ref a { text-decoration: none; }
q { quotes: "“" "”"; }

/* moments */
.moment-block, .moment-list li { margin: .5rem 0; }
.moment-ts, .moment-link { font-variant-numeric: tabular-nums; text-decoration: none; font-weight: 600; }
.moment-ts time, .moment-link time { background: var(--tint); border: 1px solid var(--line); border-radius: 4px; padding: 0 .35rem; }
.moment-note, .moment-desc { color: var(--muted); display: block; font-size: .95rem; }
.moment-list { list-style: none; padding: 0; }
.moment-list li { padding: .5rem .6rem; border-radius: 6px; display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: baseline; }
.moment-list li .moment-desc { grid-column: 2 / span 2; }
.moment-list li.selected, .moment-list li.playing { background: var(--tint); outline: 1px solid var(--line); }
.moment-yt { font-size: .8rem; white-space: nowrap; }
.hb-player { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #000; border-radius: 8px; overflow: hidden; margin: .5rem 0 1rem; min-height: 200px; }
.hb-player img.hb-facade { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.hb-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.hb-player .hb-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.75); color: #fff; padding: .7rem 1.2rem; border-radius: 999px; text-decoration: none; font-weight: 600; }
.hb-player .hb-title { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: .4rem .8rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); font-size: .85rem; }
.hb-player.live .hb-facade, .hb-player.live .hb-play, .hb-player.live .hb-title { display: none; }
.hb-player.failed { aspect-ratio: auto; background: var(--tint); color: var(--ink); padding: 1rem; min-height: 0; }

/* references + provenance */
.refs li { margin: .3rem 0; font-size: .95rem; }
.refkind { margin-left: .5rem; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.provenance { margin-top: 2rem; border: 1px solid var(--line); border-radius: 8px; padding: .4rem 1rem 1rem; background: var(--tint); }
.provenance h2 { margin-top: .6rem; font-size: 1.1rem; }
.provenance dl div { display: grid; grid-template-columns: 8rem 1fr; gap: .5rem; padding: .25rem 0; }
.provenance dd { margin: 0; }
.coi { border-left: 3px solid var(--accent); padding-left: .6rem; }

/* sign-in sheet */
.signin-sheet { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; max-width: 22rem; background: #fff; }
.signin-sheet .or { text-align: center; color: var(--muted); margin: .6rem 0; }
header .signin-sheet { position: absolute; right: 1rem; top: 3.4rem; z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
form.inline { display: inline; }
.admin-table .actions form { display: inline-block; margin: 0 .2rem .2rem 0; }
.admin-table td code { font-size: .85rem; }
.empty { color: var(--muted); }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .keyfacts div, .provenance dl div { grid-template-columns: 1fr; gap: .1rem; }
  .moment-list li { grid-template-columns: auto 1fr; }
  .moment-list li .moment-yt { grid-column: 2; }
}
