/* Design tokens — spec §5 */
:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #6d28d9;
  --accent-hover: #5b21b6;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #a78bfa;
  --accent-hover: #8b5cf6;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Base */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease;
}

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

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

.border, .border-b, .border-t {
  border-color: var(--border);
}

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

/* Header / nav */
.site-header {
  background-color: var(--surface);
}

.site-title {
  color: var(--text);
}
.site-title:hover {
  color: var(--text);
}

.nav-link {
  color: var(--muted);
  padding: 0.375rem 0.625rem;
  border-radius: 0.5rem;
}
.nav-link:hover {
  color: var(--text);
  background-color: var(--surface-2);
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-left: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}
.theme-icon-sun {
  display: none;
}
[data-theme="dark"] .theme-icon-sun {
  display: inline;
}
[data-theme="dark"] .theme-icon-moon {
  display: none;
}

/* Footer */
.site-footer {
  color: var(--muted);
}

/* Cards */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease;
}
a.card:hover {
  border-color: var(--accent);
}

.member-card .member-card-link {
  color: var(--accent);
}

.post-card-title {
  color: var(--text);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  color: #ffffff;
}
.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background-color: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge-accent {
  color: var(--accent);
  border-color: var(--accent);
  background-color: transparent;
}
.badge-published {
  color: #15803d;
  border-color: #15803d;
  background-color: transparent;
}
[data-theme="dark"] .badge-published {
  color: #4ade80;
  border-color: #4ade80;
}
.badge-draft {
  color: #b45309;
  border-color: #b45309;
  background-color: transparent;
}
[data-theme="dark"] .badge-draft {
  color: #fbbf24;
  border-color: #fbbf24;
}

/* Dashboard */
.dashboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.sort-handle {
  flex: 0 0 auto;
  cursor: grab;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: -0.15em;
  padding: 0.25rem 0.35rem;
  user-select: none;
  touch-action: none;
}
.sort-handle:active {
  cursor: grabbing;
}
.sort-dragging {
  opacity: 0.55;
  border-color: var(--accent);
}
/* Project rows have 3 children (handle, text, buttons): stretch the text
   block so it hugs the handle on the left instead of floating mid-row. */
.project-sort-row .min-w-0 {
  flex: 1 1 auto;
  text-align: left;
}

/* Extra buttons / links */
.btn-secondary {
  background-color: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-ghost {
  background-color: transparent;
  color: var(--muted);
}
.btn-ghost:hover {
  color: var(--accent);
}
.btn-danger {
  background-color: transparent;
  color: var(--muted);
}
.btn-danger:hover {
  color: #e5484d;
  border-color: #e5484d;
}
.link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link:hover {
  color: var(--accent-hover);
}

/* Forms */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  transition: border-color 0.15s ease;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-error {
  color: #dc2626;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* Messages */
.message {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: var(--surface);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}
.message-success {
  border-color: var(--accent);
  color: var(--accent);
}
.message-error {
  border-color: #dc2626;
  color: #dc2626;
}

/* Timeline (CV) */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
}
.timeline-item {
  position: relative;
  padding: 0 0 1.75rem 1.5rem;
}
.timeline-item:last-child {
  padding-bottom: 0;
}
.timeline-dot {
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  background-color: var(--accent);
  border: 2px solid var(--bg);
}

/* Rich content (sanitized blog HTML / editor) */
.post-content {
  line-height: 1.7;
  min-width: 0;
  overflow-wrap: anywhere;
}
.post-content p {
  margin: 0 0 1rem;
}
/* Rich-text links: Tailwind preflight (color: inherit) beats the bare `a`
   element selector, so links inside content need class-level specificity. */
.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.post-content a:hover {
  color: var(--accent-hover);
}
.post-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
}
.post-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.75rem 0 0.5rem;
}
.post-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}
.post-content ul,
.post-content ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}
.post-content ul {
  list-style: disc;
}
.post-content ol {
  list-style: decimal;
}
.post-content li {
  margin-bottom: 0.25rem;
}
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 0 0 1rem;
  color: var(--muted);
}
.post-content pre {
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 0 0 1rem;
}
.post-content code {
  background-color: var(--surface-2);
  border-radius: 0.25rem;
  padding: 0.1rem 0.3rem;
  font-size: 0.85em;
}
.post-content pre code {
  background: none;
  padding: 0;
}
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 0.5rem 0;
}
.post-content figure {
  margin: 0 0 1rem;
}
.post-content figcaption {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* ── Design refresh ─────────────────────────────────────────── */

:root {
  --shadow-lg: 0 12px 24px -8px rgba(15, 23, 42, 0.12);
  --accent-soft: rgba(109, 40, 217, 0.08);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", monospace;
}
[data-theme="dark"] {
  --shadow-lg: 0 12px 24px -8px rgba(0, 0, 0, 0.5);
  --accent-soft: rgba(96, 165, 250, 0.12);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

h1, h2, h3 {
  letter-spacing: -0.02em;
}

::selection {
  background-color: var(--accent);
  color: #ffffff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* Sticky, blurred header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--surface);
  background-color: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-link.active {
  color: var(--text);
  background-color: var(--surface-2);
  font-weight: 500;
}

/* Eyebrow labels — the quiet "high-tech" accent */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 1.5rem;
  height: 1px;
  background-color: var(--accent);
  opacity: 0.6;
}

/* Gradient display text (subtle, two-stop) */
.text-gradient {
  background: linear-gradient(92deg, var(--accent) 10%, #0ea5e9 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Hero with a soft glow behind it */
.hero {
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -3rem -2rem auto;
  height: 16rem;
  background: radial-gradient(ellipse 60% 70% at 50% 0%, var(--accent-soft), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* Cards lift on hover */
a.card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
a.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

/* Buttons get a little depth and motion */
.btn {
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15), 0 4px 12px -4px var(--accent-soft);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.18), 0 8px 16px -6px var(--accent-soft);
}

/* Mono meta text (dates, labels) */
.meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

/* Member card avatar */
.member-card,
.card.member-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.avatar-initials {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
}
.member-card .arrow {
  transition: transform 0.15s ease;
}
.member-card:hover .arrow {
  transform: translateX(3px);
}

/* Profile photo with accent ring */
.profile-photo {
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-lg);
}

/* Footer accent line */
.site-footer {
  position: relative;
}
.site-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.45;
}

/* Timeline dot with a soft ring */
.timeline-dot {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Syntax highlighting (highlight.js tokens) — theme-aware */
.hljs { color: var(--text); background: transparent; }
.hljs-comment, .hljs-quote { color: var(--muted); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-meta { color: #7c3aed; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #15803d; }
.hljs-number, .hljs-literal { color: #b45309; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #2563eb; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: #0e7490; }
.hljs-built_in, .hljs-type, .hljs-name { color: #be185d; }
.hljs-deletion { color: #dc2626; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

[data-theme="dark"] .hljs-keyword,
[data-theme="dark"] .hljs-selector-tag,
[data-theme="dark"] .hljs-meta { color: #c4b5fd; }
[data-theme="dark"] .hljs-string,
[data-theme="dark"] .hljs-regexp,
[data-theme="dark"] .hljs-addition { color: #86efac; }
[data-theme="dark"] .hljs-number,
[data-theme="dark"] .hljs-literal { color: #fbbf24; }
[data-theme="dark"] .hljs-title,
[data-theme="dark"] .hljs-title.function_,
[data-theme="dark"] .hljs-section { color: #93c5fd; }
[data-theme="dark"] .hljs-attr,
[data-theme="dark"] .hljs-attribute,
[data-theme="dark"] .hljs-variable,
[data-theme="dark"] .hljs-template-variable { color: #67e8f9; }
[data-theme="dark"] .hljs-built_in,
[data-theme="dark"] .hljs-type,
[data-theme="dark"] .hljs-name { color: #f9a8d4; }

/* Post gallery (editor page) */
.gallery-dropzone {
  border: 2px dashed var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.gallery-dropzone:focus {
  outline: none;
  border-color: var(--accent);
}
.gallery-dropzone.gallery-dragover {
  border-color: var(--accent);
  background-color: var(--accent-soft);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
}
.gallery-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: grab;
  background-color: var(--surface-2);
  aspect-ratio: 1;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-item-actions {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  display: flex;
  gap: 0.25rem;
}
.gallery-item-actions button {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.375rem;
  border: none;
  background-color: rgba(15, 23, 42, 0.7);
  color: #ffffff;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-star.active {
  background-color: var(--accent);
}

/* Post carousel (public blog detail) */
.carousel-viewer {
  padding: 0.5rem;
  margin-bottom: 0.75rem;
}
.carousel-viewer img {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 0.5rem;
  display: block;
}
.carousel-thumbs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.carousel-thumb {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 2px solid var(--border);
  padding: 0;
  background: none;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.carousel-thumb:hover {
  transform: translateY(-1px);
}
.carousel-thumb.active {
  border-color: var(--accent);
}
.carousel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Theme-pack hooks ───────────────────────────────────────── */

:root {
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --accent-2: #0891b2;
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
}

[data-theme="dark"] {
  --accent-2: #22d3ee;
}

h1, h2, h3, .site-title {
  font-family: var(--font-display);
}

.card {
  border-radius: var(--radius);
}
.btn {
  border-radius: var(--radius-sm);
}

.text-gradient {
  background: linear-gradient(92deg, var(--accent) 10%, var(--accent-2) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.avatar-initials {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

/* Blog list cards with featured image */
.card.post-list-card {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}
.post-list-thumb {
  width: 11.25rem;
  height: 8.125rem;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
/* The text column must be allowed to shrink and wrap long strings (URLs). */
.post-list-card .min-w-0 {
  min-width: 0;
}
.post-list-card .post-card-title,
.post-list-card p {
  overflow-wrap: anywhere;
}
@media (max-width: 560px) {
  .post-list-card {
    flex-direction: column;
    gap: 0.75rem;
  }
  .post-list-thumb {
    width: 100%;
    height: 12.5rem;
  }
}

/* Tag chips */
.tag-chip {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background-color: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
a.tag-chip:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.tag-chip.active {
  color: var(--accent);
  border-color: var(--accent);
  background-color: transparent;
}
.tag-chip-static {
  cursor: default;
}

/* Pager */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Editor tag picker */
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tag-option {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.tag-option:has(input:checked) {
  color: var(--accent);
  border-color: var(--accent);
  background-color: transparent;
}
.tag-option input {
  accent-color: var(--accent);
}

/* ── Atmosphere: ambient glows + film grain ─────────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40rem 24rem at 85% -5%, var(--accent-soft), transparent 60%),
    radial-gradient(32rem 20rem at -10% 30%, var(--accent-soft), transparent 55%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="dark"] body::after {
  opacity: 0.05;
}

/* Headings: display face + tight tracking */
h1, h2, h3, .site-title {
  letter-spacing: -0.015em;
}

/* Eyebrow with gradient ink */
.eyebrow {
  background: linear-gradient(92deg, var(--accent) 10%, var(--accent-2) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  position: relative;
}
.hero-title {
  font-size: clamp(2.5rem, 7vw, 4.25rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.hero-tagline {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  margin-top: 0.875rem;
}
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.hero-chip {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--accent);
  background-color: var(--accent-soft);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}
.hero-figure {
  position: relative;
  flex-shrink: 0;
}
.hero-figure::before {
  content: "";
  position: absolute;
  inset: -1.5rem;
  z-index: -1;
  border-radius: 1.5rem;
  background: radial-gradient(closest-side, var(--accent-soft), transparent);
  filter: blur(0.5rem);
}
.hero-img {
  width: 100%;
  max-width: 22rem;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
@media (min-width: 640px) {
  .hero-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 2rem;
    align-items: center;
  }
}

/* ── Micro-interactions ─────────────────────────────────────── */
a.card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
a.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}
.post-list-thumb {
  transition: transform 0.25s ease;
}
a.card:hover .post-list-thumb {
  transform: scale(1.03);
}
.post-card-title {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1.5px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.25s ease;
  display: inline;
}
a.card:hover .post-card-title {
  background-size: 100% 1.5px;
}
.btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease,
    color 0.15s ease, border-color 0.15s ease;
}
.btn:hover {
  transform: translateY(-1px);
}
.tag-chip,
.carousel-thumb,
.gallery-item img {
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
a.tag-chip:hover {
  transform: translateY(-1px);
}
.carousel-thumb:hover img {
  transform: scale(1.06);
}

/* ── Blog polish ────────────────────────────────────────────── */
/* Lede paragraph — blog posts only, opt-in via .post-content-lede so the
   about/projects rich-text blocks don't get an oversized first paragraph. */
.post-content-lede > p:first-of-type {
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--text);
}
.post-content pre {
  position: relative;
  padding-top: 2.5rem;
}
.post-content pre::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.9rem;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: 0.5rem 0.5rem 0 0;
}
.post-content pre::after {
  content: "";
  position: absolute;
  top: 0.65rem;
  left: 0.85rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 9999px;
  background-color: var(--border);
  box-shadow: 0.9rem 0 0 var(--border), 1.8rem 0 0 var(--border);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  a.card:hover,
  .btn:hover,
  a.tag-chip:hover {
    transform: none;
  }
}

/* ── Projects / portfolio (pinned crossfade deck + dots nav) ── */
.project-intro {
  margin-bottom: 1rem;
}
.project-deck {
  position: relative;
  /* one viewport-height of scroll track per project */
  height: calc(var(--stage-count, 1) * 100vh);
}
.project-deck-viewport {
  position: sticky;
  top: var(--header-h, 0px);
  height: calc(100vh - var(--header-h, 0px));
  display: flex;
  overflow: hidden;
}
.project-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 1rem;
  padding-top: clamp(0.5rem, 2.5vh, 1.5rem);
  pointer-events: none; /* invisible stages must not swallow clicks */
}
/* Only the image crossfades; the text card stays put and swaps per project. */
.project-stage-media {
  flex: 0 1 auto; /* shrinks so the card is never clipped */
  aspect-ratio: 16 / 10; /* hug the screenshot shape; shrink breaks it gracefully */
  min-height: 6rem;
  max-height: 46vh;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  box-sizing: border-box;
  opacity: 0;
  will-change: opacity;
}
/* no-JS fallback: show the first project until the deck JS takes over */
.project-deck:not(.is-live) .project-stage:first-child .project-stage-media {
  opacity: 1;
}
.project-stage-body {
  flex: 0 0 auto;
  box-sizing: border-box; /* match the media width exactly (padding included) */
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.project-deck:not(.is-live) .project-stage:first-child .project-stage-body,
.project-stage-body.active {
  opacity: 1;
  pointer-events: auto;
}
.project-stage-img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* always show the full screenshot, never crop */
  background-color: var(--surface);
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.18);
}
@media (min-width: 640px) {
  .project-stage-body {
    padding: 1.25rem 1.5rem;
  }
}
.project-cover-empty {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  opacity: 0.85;
}
.project-dots {
  position: fixed;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.project-dot {
  width: 0.7rem;
  height: 0.7rem;
  padding: 0;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  cursor: pointer;
  transition: transform 0.25s ease, background-color 0.25s ease;
}
.project-dot:hover {
  border-color: var(--accent);
}
.project-dots-hidden {
  opacity: 0;
  pointer-events: none;
}
.project-dots {
  transition: opacity 0.3s ease;
}
.project-dot.active {
  background-color: var(--accent);
  border-color: var(--accent);
  transform: scale(1.35);
}
@media (max-width: 639px) {
  .project-dots {
    right: 0.5rem;
  }
}

/* Modal (above the grain overlay at z-index 9999) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}
.modal-backdrop[hidden] {
  display: none;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 40rem;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
  background-color: var(--surface);
}
.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  z-index: 1;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background-color: var(--bg);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover {
  color: var(--text);
  border-color: var(--accent);
}
.project-modal-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
}
