:root {
  /* ── Colours ───────────────────────────────────────────── */
  --bg:           #FAFAF8;
  --surface:      #FFFFFF;
  --border:       color-mix(in srgb, var(--text) 15%, var(--bg));
  --border-light: color-mix(in srgb, var(--text) 8%,  var(--bg));
  --text:         #1A1916;
  --text-muted:   color-mix(in srgb, var(--text) 50%, var(--bg));
  --text-light:   color-mix(in srgb, var(--text) 25%, var(--bg));
  --tag-bg:       color-mix(in srgb, var(--text) 6%,  var(--bg));
  --page-bg:      color-mix(in srgb, var(--bg) 55%, white);

  /* ── Typography ────────────────────────────────────────── */
  --font-serif:   'Lora', Georgia, serif;       /* display/heading */
  --font-sans:    'DM Sans', system-ui, sans-serif; /* body/ui    */

  /* ── Type scale ────────────────────────────────────────── */
  --fs-display:  26px;   /* page titles, article title       */
  --fs-title:    20px;   /* profile name, section h2         */
  --fs-heading:  17px;   /* h3 in articles, card titles      */
  --fs-body:     16px;   /* article body, main reading text  */
  --fs-ui:       15px;   /* nav labels, card row titles      */
  --fs-small:    13px;   /* dates, back-links, meta          */
  --fs-caption:  11px;   /* tags, footer, uppercase labels   */

  /* ── Theme-overridable ─────────────────────────────────── */
  --btn-bg:     #1A1916;
  --btn-text:   #FFFFFF;
  --btn-radius: 100px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { background: var(--page-bg); font-family: var(--font-sans); font-size: var(--fs-body); color: var(--text); line-height: 1.6; }
a { color: inherit; text-decoration: none; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ── Preview banner ───────────────────────────────────── */
.preview-banner {
  width: 100%; background: #1A1916; color: rgba(255,255,255,0.65);
  text-align: center; padding: 9px 20px;
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  letter-spacing: 0.01em; position: sticky; top: 0; z-index: 100;
}
.preview-banner strong { color: rgba(255,255,255,0.9); font-weight: 600; }
.preview-banner a { color: #fff; font-weight: 700; text-decoration: none; }
.preview-banner a:hover { text-decoration: underline; }
.preview-sep { margin: 0 8px; opacity: 0.3; }

/* ── Page wrapper ─────────────────────────────────────── */
.page {
  min-height: 100vh;
  padding: 44px 16px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Card ─────────────────────────────────────────────── */
.card {
  width: 100%;
  max-width: 520px;
  min-height: calc(100vh - 92px); /* page padding top 44 + bottom 48 */
  background: var(--bg);
  border-radius: 24px;
  box-shadow: 0 2px 32px rgba(0,0,0,0.09), 0 1px 4px rgba(0,0,0,0.04);
  overflow: clip; /* clip trims border-radius without breaking position:sticky */
  display: flex;
  flex-direction: column;
}

/* ── Mobile: card fills full screen, grey bg hidden ───── */
@media (max-width: 600px) {
  body { background: var(--bg); }
  .page { padding: 0; background: var(--bg); }
  .card { border-radius: 0; box-shadow: none; min-height: 100vh; }
  .brand-above { display: none; }
}

/* ── Card top-bar ─────────────────────────────────────── */
.card-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
}
.card-topbar--hidden {
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.card-topbar--visible {
  opacity: 1; pointer-events: auto; transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.card-logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.card-logo-avatar {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--tag-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-ui); overflow: hidden; flex-shrink: 0;
}
.card-logo-avatar img { width: 32px; height: 32px; object-fit: cover; border-radius: 9px; }
.card-logo-name {
  font-family: var(--font-serif);
  font-size: var(--fs-ui); font-weight: 700; letter-spacing: -0.3px;
}
.card-nav { display: flex; gap: 2px; }
.card-nav a {
  font-family: var(--font-sans); font-size: var(--fs-small); font-weight: 500;
  color: var(--text-muted); padding: 6px 11px; border-radius: 9px; transition: all 0.15s;
}
.card-nav a:hover, .card-nav a.on { background: var(--tag-bg); color: var(--text); }

/* ── Hamburger ────────────────────────────────────────── */
.hamburger { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 18px; height: 2px; background: var(--text-muted); border-radius: 2px; }
.mob-nav { display: none; flex-direction: column; border-top: 1px solid var(--border-light); }
.mob-nav.open { display: flex; }
.mob-nav a {
  font-family: var(--font-sans); font-size: var(--fs-ui); font-weight: 500;
  color: var(--text-muted); padding: 13px 18px;
  border-bottom: 1px solid var(--border-light); transition: color 0.15s;
}
.mob-nav a:last-child { border-bottom: none; }
.mob-nav a:hover, .mob-nav a.on { color: var(--text); }
@media (max-width: 500px) { .card-nav { display: none; } .hamburger { display: flex; } }

/* ── Card bodies ──────────────────────────────────────── */
.card-body  { padding: 28px 20px 32px; flex: 1; }
.inner-body { padding: 24px 20px 32px; flex: 1; }

/* ── Card footer ──────────────────────────────────────── */
.card-footer {
  text-align: center; padding: 0 0 20px;
  font-family: var(--font-sans); font-size: var(--fs-caption); color: var(--text-light);
}
.card-footer a { text-decoration: underline; text-underline-offset: 2px; color: inherit; }

/* ── Mysitee brand above card ─────────────────────────── */
.brand-above {
  width: 100%; max-width: 520px;
  display: flex; align-items: center; gap: 7px;
  padding: 0 4px 12px;
  opacity: 0.55; transition: opacity 0.15s; text-decoration: none;
}
.brand-above:hover { opacity: 1; }
.brand-icon { width: 26px; height: 26px; border-radius: 7px; background: var(--text); display: flex; align-items: center; justify-content: center; }
.brand-name { font-family: var(--font-sans); font-size: var(--fs-caption); font-weight: 600; color: var(--text); }

/* ── Home: profile ────────────────────────────────────── */
.profile { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 28px; }
.profile-avatar {
  width: 72px; height: 72px; border-radius: 20px;
  background: var(--tag-bg); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; margin-bottom: 14px;
}
.profile-avatar img { width: 72px; height: 72px; object-fit: cover; }
.profile-name {
  font-family: var(--font-serif);
  font-size: var(--fs-display); font-weight: 700; letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.profile-bio {
  font-family: var(--font-sans);
  font-size: var(--fs-ui); color: var(--text-muted);
  max-width: 280px; line-height: 1.6; margin-bottom: 16px;
}

/* ── Social icons ─────────────────────────────────────── */
.socials { display: flex; gap: 6px; }
.soc {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--tag-bg); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.soc:hover { background: var(--border); color: var(--text); }

/* ── Nav cards (home buttons) ─────────────────────────── */
.nav-cards { display: flex; flex-direction: column; gap: 10px; }
.nav-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px;
  background: var(--btn-bg); border: 1px solid var(--btn-bg); border-radius: var(--btn-radius);
  transition: filter 0.15s, transform 0.12s, box-shadow 0.15s;
}
.nav-card:hover { filter: brightness(0.93); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.1); }
.nav-card-left { display: flex; align-items: center; gap: 13px; }
.nav-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,0.15); color: var(--btn-text);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nav-label { font-family: var(--font-sans); font-size: var(--fs-ui); font-weight: 600; color: var(--btn-text); }
.nav-sub   { font-family: var(--font-sans); font-size: var(--fs-small); color: var(--btn-text); opacity: 0.6; margin-top: 1px; }
.nav-arrow { color: var(--btn-text); opacity: 0.5; flex-shrink: 0; }

/* ── Page title (inner pages) ─────────────────────────── */
.page-title {
  font-family: var(--font-serif);
  font-size: var(--fs-display); font-weight: 700; letter-spacing: -0.5px;
  margin-bottom: 20px;
}

/* ── Post list — simple rows ──────────────────────────── */
.post-list { display: flex; flex-direction: column; }
.post-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
  transition: opacity 0.15s;
}
.post-list .post-row:first-child { border-top: 1px solid var(--border-light); }
.post-row:hover { opacity: 0.6; }
.post-row-title {
  font-family: var(--font-serif); font-size: var(--fs-ui); font-weight: 600;
  letter-spacing: -0.2px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-row-date { font-family: var(--font-sans); font-size: var(--fs-small); color: var(--text-light); flex-shrink: 0; }
.post-row-arrow { color: var(--text-light); flex-shrink: 0; }

/* ── Article ──────────────────────────────────────────── */
.back-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-sans); font-size: var(--fs-small); color: var(--text-muted);
  margin-bottom: 20px; transition: color 0.15s;
}
.back-link:hover { color: var(--text); }
.article-title {
  font-family: var(--font-serif);
  font-size: var(--fs-display); font-weight: 700;
  letter-spacing: -0.5px; line-height: 1.2; margin-bottom: 8px;
}
.article-subtitle {
  font-family: var(--font-sans); font-size: var(--fs-heading); color: var(--text-muted);
  line-height: 1.5; margin: 6px 0 20px;
}
.article-meta {
  font-family: var(--font-sans); font-size: var(--fs-small); color: var(--text-muted);
}
.article-body {
  font-family: var(--font-sans); font-size: var(--fs-body); line-height: 1.8;
}
.article-body p  { margin-bottom: 1.3em; }
.article-body h2 {
  font-family: var(--font-serif); font-size: var(--fs-title);
  font-weight: 700; letter-spacing: -0.3px; margin: 2em 0 0.6em;
}
.article-body h3 {
  font-family: var(--font-serif); font-size: var(--fs-heading);
  font-weight: 700; margin: 1.6em 0 0.5em;
}
.article-body a  { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border); transition: text-decoration-color 0.15s; }
.article-body a:hover { text-decoration-color: var(--text); }
.article-body blockquote { border-left: 2px solid var(--border); padding-left: 18px; color: var(--text-muted); font-style: italic; margin: 1.4em 0; }
.article-body code { font-family: monospace; font-size: var(--fs-small); background: var(--tag-bg); padding: 2px 6px; border-radius: 4px; }
.article-body pre { background: var(--text); color: var(--bg); padding: 20px 24px; border-radius: 12px; overflow-x: auto; margin: 1.6em 0; }
.article-body pre code { background: transparent; padding: 0; color: inherit; }
.article-body img { width: 100%; border-radius: 12px; margin: 1.6em 0; }
.article-body ul, .article-body ol { padding-left: 1.4em; margin-bottom: 1.4em; }
.article-body li { margin-bottom: 0.4em; }

/* ── Reaction bar ─────────────────────────────────────── */
.article-byline {
  display: flex; flex-direction: column; gap: 0; margin-bottom: 28px;
}
.article-byline .article-meta { padding-bottom: 14px; }
.article-byline .reaction-bar {
  margin-top: 0; padding-top: 14px; padding-bottom: 14px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.reaction-bar {
  display: flex; align-items: center; gap: 6px; margin-top: 40px;
  padding-top: 24px; border-top: 1px solid var(--border-light);
}
.rx-icon { width: 18px; height: 18px; flex-shrink: 0; }

.reaction-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  border: none; background: none;
  color: var(--text-light); cursor: pointer;
  transition: color 0.15s, transform 0.1s;
}
.reaction-btn:hover { color: var(--text-muted); }
.reaction-btn:active { transform: scale(0.88); }

.reaction-btn.reaction-loved { color: #e05252; }
.reaction-btn.reaction-loved .rx-icon { filter: drop-shadow(0 0 3px rgba(224,82,82,0.35)); }

/* Share wrapper + popover */
.share-wrap { position: relative; }
.share-popover {
  position: absolute; top: calc(100% + 8px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 6px; min-width: 190px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 100;
}
.share-popover.popover-hidden { display: none; }
.share-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  font-family: var(--font-sans); font-size: var(--fs-small);
  font-weight: 500; color: var(--text); text-decoration: none; cursor: pointer;
  transition: background 0.12s;
}
.share-option:hover { background: var(--tag-bg); }

/* ── Post navigation ──────────────────────────────────── */
.post-nav {
  display: flex; gap: 12px; margin-top: 24px;
  padding-top: 24px; border-top: 1px solid var(--border-light);
}
.post-nav-item {
  flex: 1; display: flex; flex-direction: column; gap: 5px;
  padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface);
  text-decoration: none; transition: border-color 0.15s, background 0.15s;
}
.post-nav-item:hover { border-color: var(--text-muted); background: var(--page-bg); }
.post-nav-next { text-align: right; }
.post-nav-label {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--font-sans); font-size: var(--fs-caption);
  font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.post-nav-next .post-nav-label { justify-content: flex-end; }
.post-nav-title {
  font-family: var(--font-serif); font-size: var(--fs-ui);
  font-weight: 600; color: var(--text); line-height: 1.35;
}

/* ── Portfolio grid ───────────────────────────────────── */
.portfolio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pf-card {
  border-radius: 14px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: transform 0.12s, box-shadow 0.15s;
}
.pf-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.pf-card-thumb {
  width: 100%; aspect-ratio: 4/3; overflow: hidden;
  background: var(--tag-bg);
}
.pf-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-card-thumb svg { width: 100%; height: 100%; display: block; }
.pf-card-info { padding: 10px 12px 12px; flex: 1; }
.pf-card-title {
  font-family: var(--font-serif); font-size: var(--fs-small); font-weight: 700;
  letter-spacing: -0.1px; line-height: 1.3; margin-bottom: 6px;
}
.pf-tag {
  display: inline-block;
  font-family: var(--font-sans); font-size: var(--fs-caption); font-weight: 600;
  letter-spacing: 0.4px; text-transform: uppercase;
  background: var(--tag-bg); color: var(--text-muted); padding: 3px 8px; border-radius: 6px;
}

/* ── Project single ───────────────────────────────────── */
.project-thumb { width: 100%; height: 180px; border-radius: 12px; object-fit: cover; margin-bottom: 16px; }
.project-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--tag-bg); display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 14px;
}
.project-desc { font-family: var(--font-sans); font-size: var(--fs-ui); color: var(--text-muted); margin-top: 6px; line-height: 1.6; }
.project-meta { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--border-light); margin-bottom: 20px; }
.project-link { font-family: var(--font-sans); font-size: var(--fs-small); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ── Links list — pill buttons ────────────────────────── */
.links-list { display: flex; flex-direction: column; gap: 10px; }
.link-pill {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px;
  background: var(--btn-bg); border: 1px solid var(--btn-bg); border-radius: var(--btn-radius);
  transition: filter 0.15s, transform 0.12s, box-shadow 0.15s;
}
.link-pill:hover { filter: brightness(0.93); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.1); }
.link-pill-label { font-family: var(--font-sans); font-size: var(--fs-ui); font-weight: 600; color: var(--btn-text); flex: 1; }
.link-pill-ext { color: var(--btn-text); opacity: 0.5; flex-shrink: 0; }

/* ── Link pill style variants (mirrors nav-card variants) ─ */
[data-btn-style="outline"] .link-pill { background: transparent; border-color: var(--btn-bg); }
[data-btn-style="outline"] .link-pill .link-pill-label { color: var(--btn-bg); }
[data-btn-style="outline"] .link-pill .link-pill-ext   { color: var(--btn-bg); opacity: 0.5; }

[data-btn-style="glass"] .link-pill { background: rgba(255,255,255,0.55); backdrop-filter: blur(8px); border-color: rgba(255,255,255,0.4); }
[data-btn-style="glass"] .link-pill .link-pill-label { color: var(--text); }
[data-btn-style="glass"] .link-pill .link-pill-ext   { color: var(--text-muted); opacity: 1; }

[data-btn-shadow="subtle"] .link-pill { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
[data-btn-shadow="strong"] .link-pill { box-shadow: 0 4px 16px rgba(0,0,0,0.18); }

/* ── Button style variants ────────────────────────────── */
[data-btn-style="outline"] .nav-card { background: transparent; border-color: var(--btn-bg); }
[data-btn-style="outline"] .nav-card .nav-label,
[data-btn-style="outline"] .nav-card .nav-sub,
[data-btn-style="outline"] .nav-card .nav-arrow,
[data-btn-style="outline"] .nav-card .nav-icon { color: var(--btn-bg); background: transparent; opacity: 1; }

[data-btn-style="glass"] .nav-card { background: rgba(255,255,255,0.55); backdrop-filter: blur(8px); border-color: rgba(255,255,255,0.4); }
[data-btn-style="glass"] .nav-card .nav-label { color: var(--text); opacity: 1; }
[data-btn-style="glass"] .nav-card .nav-sub   { color: var(--text-muted); opacity: 1; }
[data-btn-style="glass"] .nav-card .nav-arrow  { color: var(--text-light); opacity: 1; }

[data-btn-shadow="subtle"] .nav-card { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
[data-btn-shadow="strong"] .nav-card { box-shadow: 0 4px 16px rgba(0,0,0,0.18); }

/* ── SVG helpers ──────────────────────────────────────── */
svg { display: block; }

/* ── Skeleton loader ──────────────────────────────────── */
@keyframes ms-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skel {
  background: linear-gradient(
    90deg,
    var(--tag-bg) 25%,
    color-mix(in srgb, var(--tag-bg) 40%, var(--bg)) 50%,
    var(--tag-bg) 75%
  );
  background-size: 300% 100%;
  animation: ms-shimmer 1.8s ease-in-out infinite;
  border-radius: 8px;
}
.skel-home {
  display: flex; flex-direction: column; align-items: center;
}
.skel-profile-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; margin-bottom: 28px; width: 100%;
}
.skel-avatar { width: 72px; height: 72px; border-radius: 20px; }
.skel-name   { width: 140px; height: 20px; }
.skel-bio    { width: 200px; height: 14px; }
.skel-socials { display: flex; gap: 6px; margin-top: 4px; }
.skel-soc    { width: 34px; height: 34px; border-radius: 9px; }
.skel-btn       { width: 100%; height: 64px; border-radius: var(--btn-radius); margin-bottom: 10px; }
.skel-row       { width: 100%; height: 44px; border-radius: 8px; margin-bottom: 2px; }
.skel-body-line { width: 100%; height: 14px; border-radius: 6px; margin-bottom: 10px; }
