*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Apple-style design tokens ───────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --surface: #f5f5f7;
  --nav-bg: rgba(251, 251, 253, 0.8);
  --hairline: #d2d2d7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --accent: #e30000;
  --accent-hover: #ff1a1a;
  --accent-subtle: rgba(227, 0, 0, 0.08);
  --code-bg: #f5f5f7;
  /* Splash syntax colors — Xcode "Default (Light)" palette */
  --syntax-keyword: #ad3da4;
  --syntax-type: #3900a0;
  --syntax-call: #326d74;
  --syntax-property: #326d74;
  --syntax-number: #272ad8;
  --syntax-string: #d12f1b;
  --syntax-comment: #707f8c;
  --syntax-dotaccess: #326d74;
  --syntax-preprocessing: #643820;
  --font-sans: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Mono", Consolas, monospace;
  --max-w: 692px;
  --max-w-wide: 980px;
  --radius: 18px;
  --radius-sm: 12px;
  --blur: saturate(180%) blur(20px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-alt: #161617;
    --surface: #1d1d1f;
    --nav-bg: rgba(22, 22, 23, 0.8);
    --hairline: #424245;
    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #86868b;
    --accent: #ff453a;
    --accent-hover: #ff6961;
    --accent-subtle: rgba(255, 69, 58, 0.12);
    --code-bg: #161617;
    /* Splash syntax colors — Xcode "Default (Dark)" palette */
    --syntax-keyword: #ff7ab2;
    --syntax-type: #dabaff;
    --syntax-call: #67b7a4;
    --syntax-property: #67b7a4;
    --syntax-number: #d9c97c;
    --syntax-string: #ff8170;
    --syntax-comment: #7f8c98;
    --syntax-dotaccess: #67b7a4;
    --syntax-preprocessing: #fd8f3f;
  }
}

html { font-size: 17px; scroll-behavior: smooth; background: var(--bg); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.47059;
  letter-spacing: -0.022em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--accent-hover); }

::selection { background: var(--accent-subtle); }

/* ── Global nav — frosted glass, like apple.com ─────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: var(--nav-bg);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--hairline);
  /* Extend the frosted glass under the iOS status bar / notch */
  padding-top: env(safe-area-inset-top);
}

.site-header .inner {
  max-width: var(--max-w-wide);
  height: 48px;
  margin: 0 auto;
  padding: 0 max(1.375rem, env(safe-area-inset-right)) 0 max(1.375rem, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.site-name:hover { color: var(--accent); }

nav { display: flex; gap: 2rem; }
nav a {
  font-size: 0.706rem; /* 12px — apple.com globalnav size */
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}
nav a:hover { color: var(--text); }
nav a.selected { color: var(--text); }

/* ── Layout ──────────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 4rem 1.375rem 6rem;
}

.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--hairline);
  padding: 1.5rem 1.375rem;
  text-align: center;
  font-size: 0.706rem;
  letter-spacing: -0.01em;
  color: var(--text-tertiary);
}
.site-footer a { color: var(--text-secondary); }
.site-footer a:hover { color: var(--text); }

/* ── Hero / About — centered display type, like an apple.com hero ───── */
.intro {
  text-align: center;
  margin-bottom: 4.5rem;
}

.intro h1 {
  font-family: var(--font-display);
  font-size: 3rem; /* ~48px */
  font-weight: 600;
  letter-spacing: -0.003em;
  line-height: 1.08;
  margin-bottom: 0.75rem;
}

.intro .tagline {
  font-family: var(--font-display);
  font-size: 1.235rem; /* 21px */
  font-weight: 400;
  line-height: 1.381;
  letter-spacing: 0.011em;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
}

.intro p {
  max-width: 36em;
  margin: 0 auto 1rem;
  color: var(--text-secondary);
}
.intro p:last-child { margin-bottom: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-subtle);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  color: var(--accent);
  border-radius: 980px;
  font-size: 0.706rem;
  font-weight: 600;
  letter-spacing: 0;
  padding: 0.35rem 0.9rem;
  margin-bottom: 1.5rem;
}

/* ── Section eyebrows ────────────────────────────────────────────────── */
.section-title {
  font-family: var(--font-display);
  font-size: 1.65rem; /* 28px */
  font-weight: 600;
  letter-spacing: -0.021em;
  line-height: 1.14;
  color: var(--text);
  margin: 3.5rem 0 1.25rem;
}

/* ── Career timeline ─────────────────────────────────────────────────── */
.timeline {
  position: relative;
  margin-top: 1.5rem;
  padding-left: 1.75rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--hairline);
}

.timeline-entry {
  position: relative;
  padding-bottom: 2rem;
}
.timeline-entry:last-child { padding-bottom: 0; }
.timeline-entry::before {
  content: "";
  position: absolute;
  left: calc(-1.75rem + 1px);
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}

.timeline-period {
  font-size: 0.706rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.timeline-title {
  font-family: var(--font-display);
  font-size: 1.118rem; /* 19px */
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.timeline-detail {
  font-size: 0.882rem;
  letter-spacing: -0.016em;
  color: var(--text-secondary);
  max-width: 34em;
}

/* ── Post list — hairline separators ─────────────────────────────────── */
.item-list { list-style: none; }

.item-list li {
  border-top: 1px solid var(--hairline);
  padding: 1.5rem 0;
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}
.item-list li:last-child { border-bottom: 1px solid var(--hairline); }

.item-thumb-link { flex-shrink: 0; }
.item-thumb {
  width: 160px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: block;
}
.item-body { flex: 1; min-width: 0; }

.item-list .item-title {
  font-family: var(--font-display);
  font-size: 1.235rem; /* 21px */
  font-weight: 600;
  letter-spacing: -0.011em;
  line-height: 1.29;
  color: var(--text);
  display: inline-block;
  margin-bottom: 0.35rem;
}
.item-list .item-title::after {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.75em;
  margin-left: 0.35em;
  background-color: currentColor;
  -webkit-mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 16"%3E%3Cpath d="M1 1l7 7-7 7" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E') no-repeat center / contain;
  mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 16"%3E%3Cpath d="M1 1l7 7-7 7" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E') no-repeat center / contain;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.item-list .item-title:hover { color: var(--accent); }
.item-list .item-title:hover::after { opacity: 1; transform: translateX(0); }

.item-list .item-meta {
  font-size: 0.706rem;
  letter-spacing: -0.01em;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.item-list .item-description {
  font-size: 0.882rem; /* 15px */
  letter-spacing: -0.016em;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ── Tags — soft chips ───────────────────────────────────────────────── */
.tag {
  display: inline-block;
  background: var(--surface);
  border-radius: 980px;
  font-size: 0.647rem; /* 11px */
  font-weight: 600;
  letter-spacing: 0;
  padding: 0.2rem 0.65rem;
  color: var(--text-secondary);
  transition: color 0.2s ease, background 0.2s ease;
}
.tag:hover { color: var(--accent); background: var(--accent-subtle); }

.tag-description {
  font-size: 1.06rem; /* 18px */
  letter-spacing: -0.016em;
  color: var(--text-secondary);
  margin-top: 0.75rem;
}

/* ── Article ─────────────────────────────────────────────────────────── */
.post-header { margin-bottom: 3rem; }

.post-header h1 {
  font-family: var(--font-display);
  font-size: 2.353rem; /* 40px */
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.post-meta {
  font-size: 0.706rem;
  letter-spacing: -0.01em;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}
/* Keep anchor-linked headings clear of the sticky global nav. */
.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 { scroll-margin-top: calc(48px + env(safe-area-inset-top) + 1rem); }
.post-body h1 { font-size: 1.882rem; letter-spacing: 0; line-height: 1.13; }
.post-body h2 { font-size: 1.65rem; letter-spacing: -0.021em; line-height: 1.14; }
.post-body h3 { font-size: 1.235rem; letter-spacing: -0.011em; line-height: 1.29; }
.post-body h4 { font-size: 1rem; letter-spacing: -0.022em; line-height: 1.47; }

.post-body p { margin-bottom: 1.25rem; }

.post-body ul,
.post-body ol {
  margin: 0 0 1.25rem 1.5rem;
}
.post-body li { margin-bottom: 0.4rem; }

.post-body blockquote {
  background: var(--surface);
  border-radius: var(--radius);
  margin: 1.75rem 0;
  padding: 1.25rem 1.5rem;
  color: var(--text-secondary);
}
.post-body blockquote p:last-child { margin-bottom: 0; }

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  border-radius: 6px;
  padding: 0.15em 0.4em;
  color: var(--text);
}

.post-body pre {
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.75rem 0;
  font-size: 0.824rem; /* 14px */
  line-height: 1.6;
}
.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

/* ── Splash syntax highlighting ──────────────────────────────────────── */
.post-body pre code .keyword { color: var(--syntax-keyword); }
.post-body pre code .type { color: var(--syntax-type); }
.post-body pre code .call { color: var(--syntax-call); }
.post-body pre code .property { color: var(--syntax-property); }
.post-body pre code .number { color: var(--syntax-number); }
.post-body pre code .string { color: var(--syntax-string); }
.post-body pre code .comment { color: var(--syntax-comment); }
.post-body pre code .dotAccess { color: var(--syntax-dotaccess); }
.post-body pre code .preprocessing { color: var(--syntax-preprocessing); }

/* ── Copy-to-clipboard button on code blocks ─────────────────────────── */
.post-body .code-block {
  position: relative;
  margin: 1.75rem 0;
}
.post-body .code-block pre {
  margin: 0;
}
.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.3rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.copy-btn::before {
  content: "";
  width: 13px;
  height: 13px;
  background: currentColor;
  -webkit-mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Crect x="4" y="3" width="8" height="11.5" rx="1.5" fill="none" stroke="black" stroke-width="1.4"/%3E%3Cpath d="M6 3.2V2.5A1 1 0 0 1 7 1.5h2a1 1 0 0 1 1 1v.7" fill="none" stroke="black" stroke-width="1.4"/%3E%3C/svg%3E') no-repeat center / contain;
  mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Crect x="4" y="3" width="8" height="11.5" rx="1.5" fill="none" stroke="black" stroke-width="1.4"/%3E%3Cpath d="M6 3.2V2.5A1 1 0 0 1 7 1.5h2a1 1 0 0 1 1 1v.7" fill="none" stroke="black" stroke-width="1.4"/%3E%3C/svg%3E') no-repeat center / contain;
}
.copy-btn.copied::before {
  -webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cpath d="M3 8.5l3.5 3.5L13 4.5" fill="none" stroke="black" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E');
  mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cpath d="M3 8.5l3.5 3.5L13 4.5" fill="none" stroke="black" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E');
}
.post-body .code-block:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}
.copy-btn:hover {
  color: var(--text);
  border-color: var(--text-tertiary);
}
.copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
}
/* Touch devices have no hover — keep the button visible. */
@media (hover: none) {
  .copy-btn { opacity: 1; }
}

.post-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1.75rem 0;
  display: block;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 2.5rem 0;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  font-size: 0.882rem;
}
.post-body th,
.post-body td {
  border-bottom: 1px solid var(--hairline);
  padding: 0.7rem 0.9rem;
  text-align: left;
}
.post-body th {
  font-weight: 600;
  font-size: 0.706rem;
  letter-spacing: -0.01em;
  color: var(--text-tertiary);
}

.post-body a {
  color: var(--accent);
}
.post-body a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Projects grid — rounded cards on soft gray, like apple.com tiles ── */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

.project-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.3s cubic-bezier(0, 0, 0.5, 1), box-shadow 0.3s cubic-bezier(0, 0, 0.5, 1);
}
.project-card:hover {
  transform: scale(1.015);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.project-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.project-card h3::after {
  content: "";
  display: inline-block;
  width: 0.4em;
  height: 0.7em;
  margin-left: 0.35em;
  background-color: var(--accent);
  -webkit-mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 16"%3E%3Cpath d="M1 1l7 7-7 7" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E') no-repeat center / contain;
  mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 16"%3E%3Cpath d="M1 1l7 7-7 7" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E') no-repeat center / contain;
}
.project-card p {
  font-size: 0.824rem;
  letter-spacing: -0.016em;
  color: var(--text-secondary);
  line-height: 1.43;
  margin: 0;
}

/* ── Repo cards — GitHub mark ────────────────────────────────────────── */
.repo-card::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin-bottom: 0.7rem;
  background-color: var(--text-secondary);
  -webkit-mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/%3E%3C/svg%3E') no-repeat center / contain;
  mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/%3E%3C/svg%3E') no-repeat center / contain;
}

/* ── Live app cards ──────────────────────────────────────────────────── */
.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  display: block;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.app-card .card-link-label {
  display: inline-block;
  margin-top: 0.85rem;
  font-size: 0.824rem;
  font-weight: 500;
  letter-spacing: -0.016em;
  color: var(--accent);
}
.app-card .card-link-label::after {
  content: "";
  display: inline-block;
  width: 0.4em;
  height: 0.7em;
  margin-left: 0.35em;
  background-color: currentColor;
  -webkit-mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 16"%3E%3Cpath d="M1 1l7 7-7 7" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E') no-repeat center / contain;
  mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 16"%3E%3Cpath d="M1 1l7 7-7 7" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E') no-repeat center / contain;
}
.app-card h3::after { content: none; }

/* ── Community outreach ──────────────────────────────────────────────── */
.community-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

.community-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.community-photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.community-card-body { padding: 1.25rem 1.5rem 1.5rem; }
.community-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.community-card p {
  font-size: 0.824rem;
  letter-spacing: -0.016em;
  color: var(--text-secondary);
  line-height: 1.43;
  margin: 0;
}

/* ── Tag pages ───────────────────────────────────────────────────────── */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.25rem; }
.tag-list a {
  background: var(--surface);
  border-radius: 980px;
  padding: 0.45rem 1rem;
  font-size: 0.824rem;
  letter-spacing: -0.016em;
  color: var(--text-secondary);
  transition: color 0.2s ease, background 0.2s ease;
}
.tag-list a:hover { color: var(--accent); background: var(--accent-subtle); }

/* ── Social link pills with iconography ──────────────────────────────── */
.links-row { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.75rem; }

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-radius: 980px;
  padding: 0.5rem 1.1rem;
  font-size: 0.824rem;
  font-weight: 500;
  letter-spacing: -0.016em;
  color: var(--text);
  transition: color 0.2s ease, background 0.2s ease;
}
.link-pill:hover { color: var(--accent); background: var(--accent-subtle); }

.link-pill::before {
  content: "";
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: no-repeat center / contain;
  mask: no-repeat center / contain;
}
.link-pill[href*="github.com"]::before {
  -webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/%3E%3C/svg%3E');
  mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/%3E%3C/svg%3E');
}
.link-pill[href*="twitter.com"]::before,
.link-pill[href*="x.com"]::before {
  -webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24h-6.657l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/%3E%3C/svg%3E');
  mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24h-6.657l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/%3E%3C/svg%3E');
}
.link-pill[href*="linkedin.com"]::before {
  -webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0z"/%3E%3C/svg%3E');
  mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0z"/%3E%3C/svg%3E');
}

/* ── Page-level headings (sections, tag pages) ───────────────────────── */
main > h1 {
  font-family: var(--font-display);
  font-size: 2.353rem;
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.text-muted { color: var(--text-secondary); }

/* ── Floating table of contents ──────────────────────────────────────── */
.toc {
  /* iOS-style spring easings: overshoot, then settle. The gentle one drives
     the size morph; the bouncier one drives the chevron and content. */
  --toc-spring: linear(0, 0.034, 0.13, 0.272, 0.443 30%, 0.624, 0.78, 0.898, 0.976, 1.021 60%, 1.04, 1.038, 1.025, 1.01, 1, 0.997, 1);
  --toc-spring-bounce: linear(0, 0.045, 0.17, 0.35 25%, 0.55, 0.73, 0.87, 0.96, 1.03 50%, 1.09, 1.115, 1.105 65%, 1.06, 1.01, 0.978, 0.97, 0.984, 1, 1.006, 1);
  position: fixed;
  top: calc(48px + env(safe-area-inset-top) + 1rem);
  right: max(1rem, env(safe-area-inset-right));
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: max-content;
  max-width: min(280px, calc(100vw - 2rem));
}

/* The pill / card header — always visible, anchors the morph. */
.toc-toggle {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: max-content;
  font-family: inherit;
  background: var(--nav-bg);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: 980px;
  padding: 0.4rem 0.85rem;
  font-size: 0.706rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: color 0.2s ease, border-radius 0.45s var(--toc-spring);
}
.toc-toggle:hover { color: var(--text); }
.toc:not(.collapsed) .toc-toggle { color: var(--text); }

.toc-icon,
.toc-chevron {
  width: 0.9em;
  height: 0.9em;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: no-repeat center / contain;
  mask: no-repeat center / contain;
}
.toc-icon {
  -webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cg fill="none" stroke="black" stroke-width="1.5" stroke-linecap="round"%3E%3Cpath d="M5 4h9M5 8h9M5 12h9"/%3E%3Ccircle cx="1.75" cy="4" r="0.4" fill="black" stroke="none"/%3E%3Ccircle cx="1.75" cy="8" r="0.4" fill="black" stroke="none"/%3E%3Ccircle cx="1.75" cy="12" r="0.4" fill="black" stroke="none"/%3E%3C/g%3E%3C/svg%3E');
  mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cg fill="none" stroke="black" stroke-width="1.5" stroke-linecap="round"%3E%3Cpath d="M5 4h9M5 8h9M5 12h9"/%3E%3Ccircle cx="1.75" cy="4" r="0.4" fill="black" stroke="none"/%3E%3Ccircle cx="1.75" cy="8" r="0.4" fill="black" stroke="none"/%3E%3Ccircle cx="1.75" cy="12" r="0.4" fill="black" stroke="none"/%3E%3C/g%3E%3C/svg%3E');
}
/* Chevron points up when expanded (tap to collapse), down when collapsed. */
.toc-chevron {
  width: 0.7em;
  height: 0.7em;
  margin-left: 0.05rem;
  -webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cpath d="M4 6l4 4 4-4" fill="none" stroke="black" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E');
  mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cpath d="M4 6l4 4 4-4" fill="none" stroke="black" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E');
  transform: rotate(180deg);
  transition: transform 0.5s var(--toc-spring-bounce);
}
.toc.collapsed .toc-chevron { transform: rotate(0deg); }

/* Morphing body — the grid-rows 1fr⇄0fr trick animates height to/from the
   content's natural size, so the panel unfolds and folds with the spring. */
.toc-body {
  display: grid;
  grid-template-rows: 1fr;
  width: 100%;
  transition: grid-template-rows 0.5s var(--toc-spring);
}
.toc.collapsed .toc-body { grid-template-rows: 0fr; }

.toc-nav {
  overflow: hidden;
  min-height: 0;
  margin-top: 0.5rem;
  background: var(--nav-bg);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  opacity: 1;
  transform: translateY(0) scale(1);
  transform-origin: top right;
  transition: opacity 0.32s ease, transform 0.45s var(--toc-spring-bounce);
}
.toc.collapsed .toc-nav {
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
}
.toc-nav ul { list-style: none; margin: 0; padding: 0; }
.toc-nav li { margin: 0; }
.toc-nav a {
  display: block;
  padding: 0.3rem 0;
  font-size: 0.824rem;
  letter-spacing: -0.016em;
  line-height: 1.3;
  color: var(--text-secondary);
}
.toc-nav a:hover { color: var(--accent); }
/* Section currently in view, set by the scroll-spy script. */
.toc-nav a.active { color: var(--accent); font-weight: 600; }
.toc-nav .toc-level-3 a { padding-left: 0.85rem; }
.toc-nav .toc-level-4 a { padding-left: 1.7rem; }

/* ── Read Later / Continue Reading ───────────────────────────────────── */
/* Buttons sit at the trailing edge of a card or post header; keep them out of
   the flex flow so titles stay full width. */
.item-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.bookmark-btn {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 980px;
  padding: 0.35rem;
  color: var(--text-tertiary);
  font-family: inherit;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.bookmark-btn:hover { color: var(--text); background: var(--surface); }
.bookmark-btn.is-saved { color: var(--accent); }

.bookmark-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  display: block;
  background-color: currentColor;
  -webkit-mask: no-repeat center / contain;
  mask: no-repeat center / contain;
  -webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cpath d="M4 1.75h8a1.25 1.25 0 0 1 1.25 1.25v11.6L8 11.4 2.75 14.6V3A1.25 1.25 0 0 1 4 1.75z" fill="none" stroke="black" stroke-width="1.5" stroke-linejoin="round"/%3E%3C/svg%3E');
  mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cpath d="M4 1.75h8a1.25 1.25 0 0 1 1.25 1.25v11.6L8 11.4 2.75 14.6V3A1.25 1.25 0 0 1 4 1.75z" fill="none" stroke="black" stroke-width="1.5" stroke-linejoin="round"/%3E%3C/svg%3E');
}
.bookmark-btn.is-saved .bookmark-icon {
  -webkit-mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cpath d="M4 1.75h8a1.25 1.25 0 0 1 1.25 1.25v11.6L8 11.4 2.75 14.6V3A1.25 1.25 0 0 1 4 1.75z"/%3E%3C/svg%3E');
  mask-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cpath d="M4 1.75h8a1.25 1.25 0 0 1 1.25 1.25v11.6L8 11.4 2.75 14.6V3A1.25 1.25 0 0 1 4 1.75z"/%3E%3C/svg%3E');
}

/* Labeled variant lives in the post header. */
.bookmark-btn-labeled {
  border-color: var(--hairline);
  padding: 0.4rem 0.85rem;
  font-size: 0.706rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
}
.bookmark-btn-labeled:hover { color: var(--text); background: var(--surface); }
.bookmark-btn-labeled.is-saved { color: var(--accent); border-color: var(--accent-subtle); background: var(--accent-subtle); }
.bookmark-btn-labeled .bookmark-icon { width: 0.9rem; height: 0.9rem; }
.post-header .bookmark-btn-labeled { margin-top: 1.25rem; }

/* Dismiss control on Continue Reading cards. */
.continue-dismiss {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 0.15rem 0.4rem;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--text-tertiary);
  transition: color 0.2s ease, background 0.2s ease;
}
.continue-dismiss:hover { color: var(--text); background: var(--surface); }

/* Per-article progress shown on Continue Reading cards. */
.item-progress {
  height: 4px;
  max-width: 220px;
  margin-top: 0.6rem;
  border-radius: 980px;
  background: var(--surface);
  overflow: hidden;
}
.item-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.progress-label { color: var(--accent); font-weight: 600; }

/* Top-of-page reading indicator on article pages. */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 10000;
  pointer-events: none;
  background: transparent;
}
.reading-progress-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.1s linear;
}

/* ── Motion preferences ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .intro h1 { font-size: 2rem; }
  .intro .tagline { font-size: 1.118rem; }
  .post-header h1 { font-size: 1.882rem; }
  main > h1 { font-size: 1.882rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .community-grid { grid-template-columns: 1fr; }
  .item-thumb { width: 104px; }
  nav { gap: 1.25rem; }
  main { padding: 2.5rem 1.375rem 4rem; }
}
