:root {
  --bg: #F2F4F7;
  --card: #FFFFFF;
  --border: #E3E7ED;
  --border2: #D5DAE1;
  --text: #111827;
  --text2: #4B5563;
  --accent: #1B4FA3;
  --accent-h: #163F85;
  --btn: #1B4FA3;
  --btn-h: #163F85;
  --tint: #E8EFFB;
  --navy: #12306B;
  --navy-text: #E3EAF7;
  --media: #1F2937;
  --placeholder: #E8ECF2;
  --ok-bg: #E7F6EE; --ok-text: #166534;
  --err-bg: #FDECEC; --err-text: #991B1B;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --serif: Newsreader, Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1220; --card: #121A2B; --border: #253149; --border2: #2E3B55; --text: #E6EAF2; --text2: #A9B3C6;
    --accent: #7FA6E8; --accent-h: #A5C0F0; --btn: #3B6FD1; --btn-h: #2F5FBF; --tint: #1A2A4A; --placeholder: #1C2740; --media: #0F172A;
    --ok-bg: #0F2E1E; --ok-text: #86EFAC; --err-bg: #3B1515; --err-text: #FCA5A5; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1220; --card: #121A2B; --border: #253149; --border2: #2E3B55; --text: #E6EAF2; --text2: #A9B3C6;
  --accent: #7FA6E8; --accent-h: #A5C0F0; --btn: #3B6FD1; --btn-h: #2F5FBF; --tint: #1A2A4A; --placeholder: #1C2740; --media: #0F172A;
  --ok-bg: #0F2E1E; --ok-text: #86EFAC; --err-bg: #3B1515; --err-text: #FCA5A5; --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.muted { color: var(--text2); }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 720px) { .container { padding: 0 12px; } }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn svg { flex: 0 0 auto; }
.btn-primary { background: var(--btn); color: #fff; border-color: var(--btn); }
.btn-primary:hover { background: var(--btn-h); border-color: var(--btn-h); color: #fff; }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--border2); }
.btn-secondary:hover { background: var(--bg); color: var(--text); }
.btn-light { background: #fff; color: var(--navy); }
.btn-light:hover { background: #E8EFFB; color: var(--navy); }
.btn-icon { width: 40px; padding: 0; background: var(--card); color: var(--text2); border-color: var(--border2); }
.btn-icon:hover { color: var(--text); background: var(--bg); }
.btn-round { border-radius: 22px; height: 44px; }
.btn-round.btn-icon { width: 44px; }
.btn-ghost { height: 36px; padding: 0 10px; background: transparent; color: var(--text2); font-size: 13px; border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-icon-sm { width: 36px; padding: 0; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-danger { background: transparent; color: var(--err-text); border-color: var(--border2); }
.btn-danger:hover { background: var(--err-bg); }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; display: inline-flex; align-items: center; gap: 8px; }

/* ---- top bar ---- */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-in { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; background: var(--btn); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; }
.brand-tld { color: var(--text2); font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
@media (max-width: 520px) { .topbar-actions .btn-primary span { display: none; } .topbar-actions .btn-primary { width: 40px; padding: 0; } }

/* ---- profile header ---- */
.profile { background: var(--card); border-bottom: 1px solid var(--border); }
.cover { height: 320px; border-radius: 0 0 12px 12px; overflow: hidden; background: var(--navy); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.identity { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: flex-start; padding: 16px 16px 12px; }
.avatar { border-radius: 50%; overflow: hidden; background: var(--tint); display: block; flex: 0 0 auto; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-128 { width: 128px; height: 128px; margin-top: -80px; border: 4px solid var(--card); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.14); position: relative; z-index: 1; }
.avatar-56 { width: 56px; height: 56px; }
.avatar-40 { width: 40px; height: 40px; }
.id-text { flex: 1 1 380px; min-width: 0; }
.name { font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
.name-sm { font-size: 24px; }
.headline { margin-top: 6px; font-size: 17px; font-weight: 500; color: var(--text2); }
.headline-sm { margin-top: 2px; font-size: 14px; font-weight: 500; color: var(--text2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { padding: 3px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); font-size: 12px; font-weight: 500; color: var(--text2); }
.location { margin-top: 10px; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.identity .actions { padding-top: 12px; }
.tabs { display: flex; gap: 4px; border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 14px 16px; font-size: 15px; font-weight: 600; color: var(--text2); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.compact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px 16px 12px; }
.compact-id { flex: 1 1 320px; min-width: 0; }
@media (max-width: 720px) {
  .cover { height: 160px; border-radius: 0; }
  .identity { flex-direction: column; align-items: center; text-align: center; gap: 0; padding: 0 16px 16px; }
  .avatar-128 { width: 104px; height: 104px; margin-top: -52px; }
  .id-text { flex: 1 1 auto; width: 100%; }
  .name { font-size: 24px; margin-top: 8px; }
  .headline { font-size: 15px; margin-top: 4px; }
  .chips { justify-content: center; }
  .chip { font-size: 11px; padding: 2px 8px; }
  .location { justify-content: center; font-size: 13px; }
  .identity .actions { width: 100%; }
  .identity .actions .btn-primary { width: 100%; height: 44px; }
  .identity .actions .btn-secondary { flex: 1 1 0; height: 44px; }
  .tabs a { flex: 1 0 auto; text-align: center; padding: 12px; font-size: 14px; }
}

/* ---- layout ---- */
.main { padding: 24px 24px 48px; display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.main.one-col { flex-direction: column; align-items: stretch; }
.main.narrow { max-width: 808px; }
.rail { flex: 1 1 360px; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.rail-narrow { flex-basis: 320px; max-width: 320px; }
.feed { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 720px) {
  .main { padding: 12px 12px 32px; gap: 12px; }
  .rail { max-width: none; order: 2; }
  .feed { order: 1; gap: 12px; }
  .about .rail { order: 0; }
}
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-title { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head .card-title { margin-bottom: 0; }
.empty { color: var(--text2); text-align: center; padding: 40px 20px; }
.section-heading { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.section-title { font-size: 17px; font-weight: 600; padding: 0 4px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text2); margin-bottom: 8px; }
.crumb { font-size: 14px; padding: 0 4px; }
.intro-text { margin-bottom: 14px; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.facts li { display: flex; gap: 10px; align-items: flex-start; }
.facts svg { flex: 0 0 auto; margin-top: 2px; color: var(--text2); }
.linklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.linklist a { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; margin: 0 -10px; border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 500; }
.linklist a:hover { background: var(--bg); }
.linklist svg { color: var(--text2); }

/* ---- composer / forms ---- */
.composer { padding: 16px 20px; }
.composer-row { display: flex; align-items: center; gap: 12px; }
.composer-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--tint); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.composer-input { flex: 1 1 200px; min-width: 0; min-height: 44px; max-height: 320px; border-radius: 22px; border: 1px solid var(--border); background: var(--bg); padding: 10px 16px; resize: none; line-height: 1.5; }
.composer-input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.composer.open .composer-input { border-radius: 12px; min-height: 110px; }
.composer-more { display: none; margin-top: 12px; flex-direction: column; gap: 12px; }
.composer.open .composer-more { display: flex; }
.composer-help { margin: 10px 0 0 52px; font-size: 13px; color: var(--text2); }
@media (max-width: 520px) { .composer { padding: 12px; } .composer-icon { display: none; } .composer-help { margin-left: 4px; } .composer-row .btn-primary span { display: none; } .composer-row .btn-primary { width: 44px; padding: 0; } }
.form-status { margin-top: 8px; font-size: 14px; min-height: 0; }
.form-status.ok { color: var(--ok-text); }
.form-status.err { color: var(--err-text); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field-label { font-size: 13px; font-weight: 600; }
.field input[type="text"], .field input[type="email"], .field input[type="url"], .field input[type="password"], .field input[type="date"], .field select, .field textarea {
  width: 100%; min-height: 44px; border-radius: 8px; border: 1px solid var(--border2); background: var(--card); padding: 10px 12px; color: var(--text);
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; }
.field-row .field { flex: 1 1 240px; }
.hint { font-size: 12px; color: var(--text2); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.checks { justify-content: flex-end; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.dropzone { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px; border: 1px dashed var(--border2); border-radius: 10px; background: var(--bg); font-size: 13px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--border2); font-size: 13px; font-weight: 500; }
.file-chip button { width: 24px; height: 24px; border-radius: 6px; border: 0; background: var(--bg); color: var(--text2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.notice { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 8px; font-size: 14px; }
.notice.ok { background: var(--ok-bg); color: var(--ok-text); }
.notice.err { background: var(--err-bg); color: var(--err-text); }
.contact-form { gap: 16px; }

/* ---- filters ---- */
.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter { padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--border2); color: var(--text); font-size: 13px; font-weight: 500; }
.filter.active { background: var(--btn); border-color: var(--btn); color: #fff; font-weight: 600; }
.rss-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text2); }

/* ---- posts ---- */
.post-head { display: flex; align-items: center; gap: 12px; }
.post-who { flex: 1 1 auto; min-width: 0; }
.post-name { font-weight: 600; }
.post-meta { font-size: 13px; color: var(--text2); }
.post-meta a { color: inherit; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--tint); color: var(--accent); font-size: 12px; font-weight: 600; }
.pill-grey { background: var(--bg); color: var(--text2); }
.post-title { margin-top: 14px; font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.3; }
.post-title a { color: inherit; }
.post-body { margin-top: 12px; }
.post-body p + p { margin-top: 10px; }
.post-body a { word-break: break-word; }
.post-image { display: block; margin-top: 14px; border-radius: 10px; overflow: hidden; background: var(--placeholder); }
.video-thumb { position: relative; display: block; margin-top: 14px; border-radius: 10px; overflow: hidden; background: var(--media); aspect-ratio: 16 / 9; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, 0.96); color: #111827; display: flex; align-items: center; justify-content: center; }
.play-sm { width: 48px; height: 48px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--media); margin-top: 14px; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.link-card { display: flex; margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; color: var(--text); }
.link-card:hover { background: var(--bg); color: var(--text); }
.link-icon { width: 72px; background: var(--placeholder); display: flex; align-items: center; justify-content: center; color: var(--text2); flex: 0 0 auto; }
.link-text { padding: 12px 16px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.link-host { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text2); }
.link-title { font-weight: 600; line-height: 1.35; }
.post-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 14px; }
.post-actions { display: flex; align-items: center; gap: 4px; }

/* ---- videos ---- */
.featured { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.featured .video-frame { flex: 1 1 520px; margin-top: 0; }
.featured-text { flex: 1 1 300px; min-width: 0; }
.featured-title { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.25; margin-top: 4px; }
.featured .post-meta { margin-top: 10px; }
.featured .actions { margin-top: 16px; }
.video-grid { display: flex; flex-wrap: wrap; gap: 24px; }
.video-card { flex: 1 1 280px; min-width: 0; padding: 0; overflow: hidden; color: var(--text); display: flex; flex-direction: column; }
.video-card .video-thumb { margin-top: 0; border-radius: 0; }
.video-text { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.video-title { font-weight: 600; line-height: 1.35; }

/* ---- work ---- */
.work-list { display: flex; flex-direction: column; }
.work-item { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.work-item:last-child { padding-bottom: 0; }
.work-period { flex: 0 0 120px; font-size: 13px; font-weight: 600; color: var(--text2); padding-top: 2px; }
.work-text { flex: 1 1 320px; min-width: 0; }
.work-title { font-weight: 600; line-height: 1.4; }
.work-body { margin-top: 6px; font-size: 14px; }
.work-body p + p { margin-top: 6px; }

/* ---- about ---- */
.portrait-card { padding: 0; overflow: hidden; }
.portrait { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.portrait-facts { padding: 16px 20px 20px; }
.about-text { max-width: 720px; gap: 0; }
.about-title { font-family: var(--serif); font-size: 32px; font-weight: 600; margin-bottom: 10px; letter-spacing: -0.01em; }
.about-text p { font-size: 17px; line-height: 1.6; margin-bottom: 14px; }
.cta-band { margin-top: 20px; background: var(--navy); color: #fff; border-radius: 12px; padding: 24px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; }
.cta-band h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.cta-band p { color: var(--navy-text); margin: 6px 0 0; font-size: 15px; }

/* ---- footer ---- */
.footer { background: var(--card); border-top: 1px solid var(--border); margin-top: auto; }
.footer-in { padding: 20px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text2); }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: var(--text2); }

/* ---- admin ---- */
.admin-wrap { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; padding-top: 24px; padding-bottom: 48px; }
.admin-nav { flex: 0 0 220px; display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; position: sticky; top: 72px; }
.admin-nav a, .admin-nav .linklike { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 500; width: 100%; }
.admin-nav a:hover, .admin-nav .linklike:hover { background: var(--bg); }
.admin-nav svg { color: var(--text2); }
.admin-nav .inline { display: contents; }
.badge { margin-left: auto; background: var(--btn); color: #fff; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.admin-main { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.admin-main .narrow { max-width: 480px; }
.admin-main .card.narrow { margin: 40px auto 0; width: 100%; }
.admin .stack .section-heading { margin-bottom: 4px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 16px; }
.stat { flex: 1 1 140px; display: flex; flex-direction: column; gap: 4px; color: var(--text); font-size: 14px; font-weight: 500; }
.stat:hover { border-color: var(--accent); color: var(--text); }
.stat-n { font-family: var(--serif); font-size: 32px; font-weight: 600; line-height: 1; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 8px; margin: 0 -8px; border-top: 1px solid var(--border); color: var(--text); border-radius: 8px; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--bg); color: var(--text); }
.row.unread .row-title { color: var(--accent); }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-title { font-weight: 600; }
.row-excerpt { font-size: 13px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-flags { display: flex; gap: 6px; flex: 0 0 auto; }
.warn { color: var(--err-text); font-weight: 600; }
.yt-preview { margin-top: 8px; border-radius: 8px; max-width: 240px; }
.img-current { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.img-current img { max-width: 200px; border-radius: 8px; }
.message-body { white-space: normal; }
.danger-zone { display: flex; justify-content: flex-end; }
@media (max-width: 720px) {
  .admin-nav { flex: 1 1 100%; position: static; flex-direction: row; flex-wrap: wrap; }
  .admin-nav a, .admin-nav .linklike { width: auto; }
  .admin-main .card.narrow { margin-top: 8px; }
}
