/* ============ Nour Oumousse — static portfolio ============ */
:root {
  --bg: #0a0a0b;
  --surface: #121214;
  --line: #232327;
  --text: #e8e8ea;
  --muted: #8b8b93;
  --accent: #d4ff3f;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); }
.accent { color: var(--accent); }

/* engineering grid backdrop */
.grid-bg {
  position: fixed; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.25;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, black 30%, transparent 75%);
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem clamp(1rem, 5vw, 3.5rem);
  background: rgba(10, 10, 11, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.logo {
  font-family: var(--font-mono);
  font-weight: 500; letter-spacing: 0.12em;
  color: var(--text); text-decoration: none; font-size: 0.9rem;
}
.site-header nav { display: flex; gap: clamp(0.75rem, 2.5vw, 1.75rem); }
.site-header nav a {
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--muted); text-decoration: none; transition: color 0.2s;
}
.site-header nav a:hover, .site-header nav a:focus-visible { color: var(--accent); }
.status {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted);
  display: flex; align-items: center; gap: 0.45rem;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); display: inline-block;
  animation: blink 2.2s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (max-width: 720px) { .status { display: none; } }

/* ---------- layout ---------- */
main { max-width: 1060px; margin: 0 auto; padding: 0 clamp(1rem, 5vw, 2.5rem); }
section { padding: clamp(4rem, 9vw, 7rem) 0; border-bottom: none; }

.section-head { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 2.5rem; }
.section-head h2 { font-family: var(--font-mono); font-size: 0.95rem; font-weight: 500; letter-spacing: 0.05em; white-space: nowrap; }
.rule { flex: 1; height: 1px; background: var(--line); }

/* ---------- hero ---------- */
.hero { padding-top: clamp(5rem, 12vw, 9rem); }
.kicker { color: var(--muted); font-size: 0.85rem; margin-bottom: 1.25rem; }
.hero h1 {
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  line-height: 1.05; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}
.lede { max-width: 56ch; color: var(--muted); font-size: clamp(1rem, 2vw, 1.15rem); margin-bottom: 2.25rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-bottom: 3rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.85rem;
  color: var(--text); text-decoration: none;
  padding: 0.7rem 1.25rem; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, color 0.2s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #0a0a0b; border-color: var(--accent); font-weight: 500; }
.btn-primary:hover { color: #0a0a0b; box-shadow: 0 0 24px rgba(212, 255, 63, 0.25); }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.1rem; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  padding: 1.4rem; display: flex; flex-direction: column; gap: 0.7rem;
  transition: border-color 0.25s, transform 0.25s;
}
.card:hover { border-color: var(--accent); transform: translateY(-4px); }
.card-top { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); letter-spacing: 0.08em; }
.card-top .year { color: var(--accent); }
.card h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.card p { font-size: 0.88rem; color: var(--muted); flex: 1; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li {
  font-size: 0.68rem; color: var(--muted);
  border: 1px solid var(--line); padding: 0.18rem 0.55rem; border-radius: 99px;
}

/* ---------- timeline ---------- */
.timeline { list-style: none; display: flex; flex-direction: column; }
.timeline li {
  display: grid; grid-template-columns: 160px 1fr; gap: 1.5rem;
  padding: 1.6rem 0; border-top: 1px solid var(--line);
}
.timeline li:first-child { border-top: none; }
.tl-date { font-size: 0.78rem; color: var(--accent); padding-top: 0.2rem; }
.timeline h3 { font-size: 1.05rem; font-weight: 700; }
.tl-org { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); margin: 0.15rem 0 0.5rem; }
.timeline li p:last-child { font-size: 0.9rem; color: var(--muted); max-width: 65ch; }
@media (max-width: 640px) {
  .timeline li { grid-template-columns: 1fr; gap: 0.4rem; }
}

/* ---------- contact ---------- */
.contact-box {
  border: 1px solid var(--line); background: var(--surface);
  padding: clamp(1.75rem, 5vw, 3rem);
  display: flex; flex-direction: column; align-items: flex-start; gap: 1.1rem;
}
.contact-line { font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 700; letter-spacing: -0.01em; }
.btn-copy {
  font-size: 0.75rem;
  padding: 0.5rem 0.9rem;
  background: var(--accent);
  color: #0a0a0b !important;
  border-color: var(--accent);
  font-weight: 500;
}
.btn-copy:hover {
  color: #0a0a0b !important;
  box-shadow: 0 0 24px rgba(212, 255, 63, 0.2);
}
.socials { list-style: none; display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 0.5rem; }
.socials a { color: var(--muted); text-decoration: none; font-size: 0.8rem; transition: color 0.2s; }
.socials a:hover { color: var(--accent); }

/* ---------- footer ---------- */
.site-footer {
  max-width: 1060px; margin: 0 auto;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem;
  padding: 1.5rem clamp(1rem, 5vw, 2.5rem) 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.72rem; color: var(--muted);
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .dot { animation: none; }
}


/* ---------- portfolio refinements ---------- */
.logo {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  white-space: nowrap;
}
.work-link {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding: 0.38rem 0.7rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 0.68rem;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.2s;
}
.work-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}
.work-more {
  display: flex;
  justify-content: center;
  margin-top: 1.75rem;
}


/* ---------- testimonials marquee ---------- */
.testimonials-intro {
  color: var(--muted);
  font-size: 0.95rem;
  margin: -1.35rem 0 1.75rem;
}
.testimonial-marquee {
  width: calc(100vw - 1rem);
  max-width: 100%;
  overflow: hidden;
  margin-left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0 1rem;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.testimonial-track {
  display: flex;
  width: max-content;
  gap: 1rem;
  animation: testimonial-scroll 68s linear infinite;
}
.testimonial-group {
  display: flex;
  align-items: stretch;
  gap: 1rem;
}
.testimonial-card {
  width: min(360px, 78vw);
  min-height: 270px;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
}
.testimonial-mark {
  color: var(--accent);
  font-size: 2.4rem;
  line-height: 1;
  font-weight: 700;
  margin-bottom: 0.65rem;
}
.testimonial-card blockquote {
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.65;
  flex: 1;
}
.testimonial-author {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.testimonial-author strong {
  font-size: 0.95rem;
  font-weight: 500;
}
.testimonial-author span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.5;
}
.testimonial-marquee:hover .testimonial-track,
.testimonial-marquee:focus-within .testimonial-track {
  animation-play-state: paused;
}
@keyframes testimonial-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-50% - 0.5rem)); }
}
@media (max-width: 640px) {
  .testimonial-card { min-height: 300px; padding: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .testimonial-track { animation: none; width: auto; }
  .testimonial-marquee {
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .testimonial-group { flex-wrap: wrap; justify-content: center; }
  .testimonial-group[aria-hidden="true"] { display: none; }
  .testimonial-card { width: min(360px, 100%); }
}


/* Contact action buttons */
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.btn-download {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
  font-weight: 400;
}
.btn-download:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: none;
}
@media (max-width: 420px) {
  .contact-actions { width: 100%; }
  .contact-actions .btn { flex: 1 1 auto; justify-content: center; }
}


/* Match the two contact actions exactly */
.contact-actions .btn {
  width: 160px;
  min-height: 42px;
  justify-content: center;
  font-size: 0.75rem;
  padding: 0.5rem 0.9rem;
}
@media (max-width: 420px) {
  .contact-actions .btn {
    width: auto;
    flex: 1 1 0;
  }
}


/* Final contact button appearance: Copy Email is the lime primary action */
.contact-actions #copy-btn {
  background: var(--accent) !important;
  color: #0a0a0b !important;
  border: 1px solid var(--accent) !important;
  font-weight: 500 !important;
}
.contact-actions #copy-btn:hover,
.contact-actions #copy-btn:focus-visible {
  background: var(--accent) !important;
  color: #0a0a0b !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 24px rgba(212, 255, 63, 0.2);
}
.contact-actions .btn-download {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  font-weight: 400 !important;
}
.contact-actions .btn-download:hover,
.contact-actions .btn-download:focus-visible {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  box-shadow: none !important;
}


/* Contact buttons — same scale as hero buttons, equal widths */
.contact-box .contact-actions > #copy-btn,
.contact-box .contact-actions > .btn-download {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  flex: 0 0 145px !important;
  width: 145px !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0.7rem 1.25rem !important;
  font-family: var(--font-mono) !important;
  font-size: 0.85rem !important;
  line-height: 1.6 !important;
  text-align: center !important;
  text-decoration: none !important;
  border-width: 1px !important;
  border-style: solid !important;
  border-radius: 0 !important;
}
.contact-box .contact-actions > #copy-btn {
  background: var(--accent) !important;
  color: #0a0a0b !important;
  border-color: var(--accent) !important;
  font-weight: 500 !important;
}
.contact-box .contact-actions > #copy-btn:hover,
.contact-box .contact-actions > #copy-btn:focus-visible {
  background: var(--accent) !important;
  color: #0a0a0b !important;
  border-color: var(--accent) !important;
}
.contact-box .contact-actions > .btn-download {
  background: transparent !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
  font-weight: 400 !important;
}
.contact-box .contact-actions > .btn-download:hover,
.contact-box .contact-actions > .btn-download:focus-visible {
  background: var(--surface) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}
@media (max-width: 520px) {
  .contact-box .contact-actions {
    width: 100%;
    gap: 0.75rem;
  }
  .contact-box .contact-actions > #copy-btn,
  .contact-box .contact-actions > .btn-download {
    flex: 1 1 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    padding: 0.7rem 0.45rem !important;
    font-size: 0.85rem !important;
  }
}


/* Three independent availability status pulses */
.status-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}
.status-dots .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: block;
  opacity: 0.3;
  transform: scale(0.82);
  animation-name: status-pulse;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
.status-dots .dot-1 { animation-duration: 1.15s; animation-delay: 0s; }
.status-dots .dot-2 { animation-duration: 1.85s; animation-delay: 0.24s; }
.status-dots .dot-3 { animation-duration: 2.65s; animation-delay: 0.51s; }
@keyframes status-pulse {
  0%, 100% { opacity: 0.28; transform: scale(0.82); }
  45%, 60% { opacity: 1; transform: scale(1.18); }
}
@media (prefers-reduced-motion: reduce) {
  .status-dots .dot { animation: none; opacity: 1; transform: none; }
}


/* Let Download CV size to its full label instead of the Copy Email width */
.contact-box .contact-actions > .btn-download {
  flex: 0 0 auto !important;
  width: max-content !important;
  min-width: max-content !important;
  max-width: 100% !important;
  white-space: nowrap !important;
  gap: 0.55rem !important;
}
@media (max-width: 520px) {
  .contact-box .contact-actions > .btn-download {
    flex: 0 0 auto !important;
    width: max-content !important;
    min-width: max-content !important;
    max-width: 100% !important;
    white-space: nowrap !important;
  }
}


/* Current-page navigation state */
.site-header nav a.active,
.site-header nav a[aria-current="page"] {
  color: var(--accent);
}


/* Community page: no horizontal separators between sections */
body.community-page main#top > section,
body.community-page main#top > section:not(:last-child) {
  border-bottom: 0 !important;
  box-shadow: none !important;
}


/* Blog article list */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.blog-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem;
  padding: clamp(1.1rem, 3vw, 1.6rem);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.2s, transform 0.2s;
}
.blog-entry:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.blog-entry-content {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}
.blog-entry-meta {
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}
.blog-entry h3 {
  color: var(--text);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 500;
}
.blog-entry-subtitle {
  max-width: 72ch;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.blog-entry-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  flex: 0 0 auto;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.7rem;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.blog-entry-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.blog-state {
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1rem 0;
}
.blog-footnote {
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 1.2rem;
}

/* Keep the growing navigation usable on tablet and mobile */
@media (max-width: 900px) {
  .site-header { gap: 0.65rem; }
  .site-header nav { gap: 0.75rem; }
  .site-header nav a { font-size: 0.72rem; }
  .status { font-size: 0.65rem; }
}
@media (max-width: 720px) {
  .site-header { flex-wrap: wrap; }
  .site-header nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
  }
}
@media (max-width: 420px) {
  .site-header nav { justify-content: flex-start; }
  .site-header nav a { font-size: 0.68rem; }
  .blog-entry { grid-template-columns: 1fr; gap: 0.9rem; }
  .blog-entry-link { justify-self: start; }
}


/* Article reader page */
.article-shell {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 5vw, 2.5rem) clamp(5rem, 9vw, 7rem);
}
.article-back {
  display: inline-flex;
  color: var(--muted);
  font-size: 0.75rem;
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color 0.2s;
}
.article-back:hover { color: var(--accent); }
.article-heading {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}
.article-meta {
  color: var(--accent);
  font-size: 0.72rem;
  margin-bottom: 1rem;
  letter-spacing: 0.06em;
}
.article-heading h1 {
  max-width: 18ch;
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}
.article-subtitle {
  max-width: 58ch;
  margin-top: 1rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.6;
}
.article-content {
  max-width: 72ch;
  margin-top: 2.3rem;
  color: var(--text);
  font-size: clamp(1rem, 1.5vw, 1.08rem);
  line-height: 1.85;
  overflow-wrap: anywhere;
}
.article-content > * + * { margin-top: 1.2rem; }
.article-content h2,
.article-content h3,
.article-content h4 {
  margin-top: 2.2rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.article-content h2 { font-size: 1.7rem; }
.article-content h3 { font-size: 1.35rem; }
.article-content h4 { font-size: 1.1rem; }
.article-content a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.article-content ul,
.article-content ol { padding-left: 1.5rem; }
.article-content li { padding-left: 0.25rem; margin: 0.35rem 0; }
.article-content blockquote {
  margin-left: 0;
  padding: 0.25rem 0 0.25rem 1.2rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}
.article-content pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  line-height: 1.65;
}
.article-content :not(pre) > code {
  padding: 0.12rem 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.88em;
}
.article-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.8rem auto;
}
.article-content hr {
  border: 0;
  border-top: 1px solid var(--line);
}


/* Floating, draggable project-card canvas */
.work-page .floating-workspace {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: clamp(1.4rem, 3vw, 3rem);
  padding: clamp(1.25rem, 3vw, 2.5rem) clamp(.25rem, 1vw, .75rem) 3rem;
  isolation: isolate;
}
.work-page .floating-project {
  --drag-x: 0px;
  --drag-y: 0px;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--card-width, 340px);
  justify-self: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 13px;
  background: #171918;
  box-shadow: 0 18px 45px rgba(0,0,0,.32), 0 2px 8px rgba(0,0,0,.18);
  transform: translate3d(var(--drag-x),var(--drag-y),0) rotate(var(--tilt,0deg));
  translate: 0 0;
  animation: project-card-float 6.5s ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
  transition: box-shadow .25s ease, border-color .25s ease;
  will-change: transform, translate;
}
.work-page .floating-project:nth-child(2),
.work-page .floating-project:nth-child(5) { margin-top: 2.4rem; }
.work-page .floating-project:nth-child(3),
.work-page .floating-project:nth-child(6) { margin-top: .8rem; }
.work-page .floating-project.is-dragging {
  z-index: 20;
  animation-play-state: paused;
  transition: none;
  border-color: rgba(212,255,63,.7);
  box-shadow: 0 28px 70px rgba(0,0,0,.48), 0 0 0 1px rgba(212,255,63,.16);
  cursor: grabbing;
}
.work-page .project-drag-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  min-height: 34px;
  padding: .45rem .75rem;
  color: rgba(245,245,235,.66);
  background: #202421;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: .59rem;
  letter-spacing: .1em;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.work-page .project-drag-handle span:nth-child(2) {
  margin-right: auto;
}
.work-page .project-drag-handle span:last-child {
  color: #d4ff3f;
}
.work-page .floating-project-image {
  display: block;
  width: 100%;
  aspect-ratio: 1.22 / 1;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}
.work-page .floating-project-info {
  padding: 1rem 1.05rem 1.05rem;
}
.work-page .floating-project-info > p {
  margin: 0 0 .55rem;
  color: #a4ad9a;
  font-size: .59rem;
  line-height: 1.5;
  letter-spacing: .07em;
}
.work-page .floating-project-info h3 {
  color: #f4f3eb;
  font-size: clamp(1.05rem, 1.4vw, 1.35rem);
  line-height: 1.22;
  font-weight: 500;
  letter-spacing: -.035em;
}
.work-page .floating-project-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  color: #90988d;
  font-size: .61rem;
  letter-spacing: .08em;
}
.work-page .floating-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  min-height: 32px;
  padding: .45rem .75rem;
  border: 1px solid rgba(212,255,63,.55);
  border-radius: 3px;
  color: #d4ff3f;
  text-decoration: none;
  font-size: .65rem;
  letter-spacing: .06em;
  transition: background .2s, color .2s, border-color .2s;
}
.work-page .floating-open:hover,
.work-page .floating-open:focus-visible {
  color: #11140d;
  background: #d4ff3f;
  border-color: #d4ff3f;
}
.work-page .workspace-hint {
  margin: -.6rem 0 1rem;
  color: var(--muted);
  font-size: .62rem;
  letter-spacing: .1em;
  text-align: center;
}
@keyframes project-card-float {
  0%,100% { translate: 0 0; }
  50% { translate: 0 -9px; }
}
@media (max-width: 900px) {
  .work-page .floating-workspace { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .work-page .floating-workspace {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem .25rem 2rem;
  }
  .work-page .floating-project,
  .work-page .floating-project:nth-child(n) {
    width: min(100%, 390px);
    max-width: none;
    margin-top: 0;
  }
  .work-page .project-drag-handle { min-height: 40px; }
  .work-page .workspace-hint { line-height: 1.6; }
}
@media (prefers-reduced-motion: reduce) {
  .work-page .floating-project { animation: none; }
}


/* Pointer dragging is available across the full card surface, not only its label bar. */
.work-page .floating-project {
  touch-action: none;
  cursor: grab;
}
.work-page .floating-project.is-dragging {
  cursor: grabbing;
}
.work-page .floating-project a,
.work-page .floating-project button {
  cursor: pointer;
}
.work-page .floating-project-image {
  -webkit-user-drag: none;
}


/* Respect reduced-motion preferences across all page animations. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}


/* Optional visitor-controlled ambient synth toggle */
.music-toggle {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  width: 25px;
  height: 25px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font: 500 1rem/1 var(--font-mono);
  cursor: pointer;
  margin-left: 0.15rem;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.music-toggle:hover,
.music-toggle:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}
.music-toggle[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(212,255,63,.08);
  box-shadow: 0 0 12px rgba(212,255,63,.18);
}
.music-toggle span { display: block; transform: translateY(-1px); }
@media (max-width: 760px) {
  .site-header { flex-wrap: wrap; }
  .status { margin-left: auto; }
}


/* Keep the music control before the availability indicator on every viewport. */
.status {
  flex-direction: row;
  white-space: nowrap;
}
.music-toggle {
  margin: 0 0.1rem 0 0;
  flex: 0 0 25px;
}
@media (max-width: 720px) {
  .status {
    display: flex;
    margin-left: auto;
    font-size: 0.65rem;
    gap: 0.35rem;
  }
}


/* Identical availability/music control layout on every page. */
.site-header > .status {
  display: inline-flex !important;
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  white-space: nowrap;
  margin-left: 0;
}
.site-header > .status > .music-toggle { order: 0; }
.site-header > .status > .dot { order: 1; }
.site-header > .status > .status-label { order: 2; }
.site-header > .status > .music-toggle {
  margin: 0 0.1rem 0 0;
  flex: 0 0 25px;
}
@media (max-width: 720px) {
  .site-header > .status {
    display: inline-flex !important;
    margin-left: auto;
    font-size: 0.65rem;
  }
}


/* Share link action at the end of each article */
.article-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.article-copy-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.7rem 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: color .2s, border-color .2s, transform .2s;
}
.article-copy-link:hover,
.article-copy-link:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}
.article-copy-status {
  color: var(--accent);
  font-size: 0.7rem;
}


/* ---------- visitor-controlled light theme ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f1;
  --surface: #ffffff;
  --line: #deded7;
  --text: #20211d;
  --muted: #686b62;
  --accent: #668500;
}
:root[data-theme="light"] .site-header {
  background: rgba(245, 245, 241, 0.88);
}
:root[data-theme="light"] .btn-primary {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}
:root[data-theme="light"] .btn-primary:hover { color: #ffffff; }
:root[data-theme="light"] .btn-copy {
  color: #ffffff !important;
  background: var(--accent);
  border-color: var(--accent);
}
:root[data-theme="light"] .btn-copy:hover { color: #ffffff !important; }
:root[data-theme="light"] .music-toggle[aria-pressed="true"] {
  background: rgba(102, 133, 0, 0.1);
  box-shadow: 0 0 12px rgba(102, 133, 0, 0.12);
}
:root[data-theme="light"] .work-page .floating-project {
  background: #ffffff;
  border-color: #d9ddd2;
  box-shadow: 0 18px 45px rgba(35, 42, 24, 0.12), 0 2px 8px rgba(35, 42, 24, 0.06);
}
:root[data-theme="light"] .work-page .project-drag-handle {
  color: #62685a;
  background: #edf0e8;
  border-bottom-color: #dfe3d8;
}
:root[data-theme="light"] .work-page .project-drag-handle span:last-child {
  color: var(--accent);
}
:root[data-theme="light"] .work-page .floating-project-info > p,
:root[data-theme="light"] .work-page .floating-project-bottom {
  color: #73796a;
}
:root[data-theme="light"] .work-page .floating-project-info h3 {
  color: #252820;
}
:root[data-theme="light"] .work-page .floating-open {
  color: var(--accent);
  border-color: rgba(102, 133, 0, 0.55);
}
:root[data-theme="light"] .work-page .floating-open:hover,
:root[data-theme="light"] .work-page .floating-open:focus-visible {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}
.theme-toggle {
  appearance: none;
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: transparent;
  font: 1.05rem/1 var(--font-mono);
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
  transform: rotate(12deg);
}
:root[data-theme="light"] .theme-toggle {
  color: #34382b;
  background: rgba(255,255,255,.55);
}
@media (max-width: 900px) {
  .theme-toggle { width: 30px; height: 30px; flex-basis: 30px; }
}


/* Music and appearance controls sit together in the header. */
.site-header > .theme-toggle,
.site-header > .music-toggle {
  margin: 0;
  flex: 0 0 34px;
}
.site-header > .status {
  gap: 0.45rem;
}
.site-header > .status > .dot { order: 0; }
.site-header > .status > .status-label { order: 1; }
.site-header > .status > .music-toggle { display: none; }
@media (max-width: 900px) {
  .site-header > .theme-toggle,
  .site-header > .music-toggle {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
}


/* Fixed floating preference controls, shared by every page. */
.floating-controls {
  position: fixed;
  right: max(1.5rem, env(safe-area-inset-right));
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
}
.floating-controls .theme-toggle,
.floating-controls .music-toggle {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  margin: 0;
  color: var(--text);
  border-color: var(--line);
  background: transparent;
}
.floating-controls .theme-toggle:hover,
.floating-controls .music-toggle:hover,
.floating-controls .theme-toggle:focus-visible,
.floating-controls .music-toggle:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}
:root[data-theme="light"] .floating-controls {
  background: rgba(255,255,255,.96);
  box-shadow: 0 8px 30px rgba(30,35,20,.14);
}
:root[data-theme="light"] .floating-controls .theme-toggle,
:root[data-theme="light"] .floating-controls .music-toggle {
  color: #34382b;
  background: transparent;
}
@media (max-width: 600px) {
  .floating-controls {
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    padding: 0.4rem;
    gap: 0.35rem;
  }
  .floating-controls .theme-toggle,
  .floating-controls .music-toggle {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
}


/* Light theme: Copy Email sits on the darker green accent, so its text stays white.
   Needs the #copy-btn selector to outrank the dark-text rules above. */
:root[data-theme="light"] .contact-box .contact-actions > #copy-btn,
:root[data-theme="light"] .contact-box .contact-actions > #copy-btn:hover,
:root[data-theme="light"] .contact-box .contact-actions > #copy-btn:focus-visible {
  color: #ffffff !important;
}


/* Floating, draggable project-card canvas */
.hero-preview-workspace .floating-workspace {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: clamp(1.4rem, 3vw, 3rem);
  padding: clamp(1.25rem, 3vw, 2.5rem) clamp(.25rem, 1vw, .75rem) 3rem;
  isolation: isolate;
}
.hero-preview-workspace .floating-project {
  --drag-x: 0px;
  --drag-y: 0px;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--card-width, 340px);
  justify-self: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 13px;
  background: #171918;
  box-shadow: 0 18px 45px rgba(0,0,0,.32), 0 2px 8px rgba(0,0,0,.18);
  transform: translate3d(var(--drag-x),var(--drag-y),0) rotate(var(--tilt,0deg));
  translate: 0 0;
  animation: project-card-float 6.5s ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
  transition: box-shadow .25s ease, border-color .25s ease;
  will-change: transform, translate;
}
.hero-preview-workspace .floating-project:nth-child(2),
.hero-preview-workspace .floating-project:nth-child(5) { margin-top: 2.4rem; }
.hero-preview-workspace .floating-project:nth-child(3),
.hero-preview-workspace .floating-project:nth-child(6) { margin-top: .8rem; }
.hero-preview-workspace .floating-project.is-dragging {
  z-index: 20;
  animation-play-state: paused;
  transition: none;
  border-color: rgba(212,255,63,.7);
  box-shadow: 0 28px 70px rgba(0,0,0,.48), 0 0 0 1px rgba(212,255,63,.16);
  cursor: grabbing;
}
.hero-preview-workspace .project-drag-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  min-height: 34px;
  padding: .45rem .75rem;
  color: rgba(245,245,235,.66);
  background: #202421;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: .59rem;
  letter-spacing: .1em;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.hero-preview-workspace .project-drag-handle span:nth-child(2) {
  margin-right: auto;
}
.hero-preview-workspace .project-drag-handle span:last-child {
  color: #d4ff3f;
}
.hero-preview-workspace .floating-project-image {
  display: block;
  width: 100%;
  aspect-ratio: 1.22 / 1;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}
.hero-preview-workspace .floating-project-info {
  padding: 1rem 1.05rem 1.05rem;
}
.hero-preview-workspace .floating-project-info > p {
  margin: 0 0 .55rem;
  color: #a4ad9a;
  font-size: .59rem;
  line-height: 1.5;
  letter-spacing: .07em;
}
.hero-preview-workspace .floating-project-info h3 {
  color: #f4f3eb;
  font-size: clamp(1.05rem, 1.4vw, 1.35rem);
  line-height: 1.22;
  font-weight: 500;
  letter-spacing: -.035em;
}
.hero-preview-workspace .floating-project-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  color: #90988d;
  font-size: .61rem;
  letter-spacing: .08em;
}
.hero-preview-workspace .floating-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  min-height: 32px;
  padding: .45rem .75rem;
  border: 1px solid rgba(212,255,63,.55);
  border-radius: 3px;
  color: #d4ff3f;
  text-decoration: none;
  font-size: .65rem;
  letter-spacing: .06em;
  transition: background .2s, color .2s, border-color .2s;
}
.hero-preview-workspace .floating-open:hover,
.hero-preview-workspace .floating-open:focus-visible {
  color: #11140d;
  background: #d4ff3f;
  border-color: #d4ff3f;
}
.hero-preview-workspace .workspace-hint {
  margin: -.6rem 0 1rem;
  color: var(--muted);
  font-size: .62rem;
  letter-spacing: .1em;
  text-align: center;
}
@keyframes project-card-float {
  0%,100% { translate: 0 0; }
  50% { translate: 0 -9px; }
}
@media (max-width: 900px) {
  .hero-preview-workspace .floating-workspace { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .hero-preview-workspace .floating-workspace {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem .25rem 2rem;
  }
  .hero-preview-workspace .floating-project,
  .hero-preview-workspace .floating-project:nth-child(n) {
    width: min(100%, 390px);
    max-width: none;
    margin-top: 0;
  }
  .hero-preview-workspace .project-drag-handle { min-height: 40px; }
  .hero-preview-workspace .workspace-hint { line-height: 1.6; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-preview-workspace .floating-project { animation: none; }
}


/* Pointer dragging is available across the full card surface, not only its label bar. */
.hero-preview-workspace .floating-project {
  touch-action: none;
  cursor: grab;
}
.hero-preview-workspace .floating-project.is-dragging {
  cursor: grabbing;
}
.hero-preview-workspace .floating-project a,
.hero-preview-workspace .floating-project button {
  cursor: pointer;
}
.hero-preview-workspace .floating-project-image {
  -webkit-user-drag: none;
}




/* Homepage hero featured project card, mirroring the work-page card interaction. */
@media (min-width: 1050px) {
  body:not(.work-page) main > .hero {
    display:grid; grid-template-columns:minmax(0,1.1fr) minmax(300px,.9fr);
    column-gap:clamp(2rem,5vw,6rem); align-items:center;
    min-height:min(760px,calc(100vh - 62px));
    padding-top:clamp(3rem,6vw,5rem); padding-bottom:4rem;
  }
  body:not(.work-page) main > .hero > .kicker,
  body:not(.work-page) main > .hero > h1,
  body:not(.work-page) main > .hero > .lede,
  body:not(.work-page) main > .hero > .hero-actions { grid-column:1; }
  body:not(.work-page) main > .hero > .hero-preview-wrap {
    grid-column:2; grid-row:1 / span 4; align-self:center;
  }
}
.hero-preview-wrap { min-width:0; position:relative; }
.hero-preview-workspace { position:relative; display:grid; place-items:center; min-height:440px; padding:1rem; isolation:isolate; }
.hero-preview-workspace .floating-project { width:min(100%,360px); max-width:360px; }
.hero-preview-hint { margin:-.25rem 0 0; color:var(--muted); font-size:.62rem; letter-spacing:.1em; text-align:center; }
@media (max-width:1049px) { .hero-preview-wrap { max-width:390px; margin:2rem auto 0; } .hero-preview-workspace { min-height:390px; } }
@media (max-width:600px) { .hero-preview-workspace { min-height:360px; padding:.5rem; } }


/* Homepage featured card follows the active site theme, just like Work cards. */
:root[data-theme="light"] .hero-preview-workspace .floating-project {
  background: #ffffff;
  border-color: #d9ddd2;
  box-shadow: 0 18px 45px rgba(35, 42, 24, 0.12), 0 2px 8px rgba(35, 42, 24, 0.06);
}
:root[data-theme="light"] .hero-preview-workspace .project-drag-handle {
  color: #62685a;
  background: #edf0e8;
  border-bottom-color: #dfe3d8;
}
:root[data-theme="light"] .hero-preview-workspace .project-drag-handle span:last-child {
  color: var(--accent);
}
:root[data-theme="light"] .hero-preview-workspace .floating-project-info > p,
:root[data-theme="light"] .hero-preview-workspace .floating-project-bottom {
  color: #73796a;
}
:root[data-theme="light"] .hero-preview-workspace .floating-project-info h3 {
  color: #252820;
}
:root[data-theme="light"] .hero-preview-workspace .floating-open {
  color: var(--accent);
  border-color: rgba(102, 133, 0, 0.55);
}
:root[data-theme="light"] .hero-preview-workspace .floating-open:hover,
:root[data-theme="light"] .hero-preview-workspace .floating-open:focus-visible {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}


/* ============ Bookmarks archive ============ */
.bookmarks-page main > section:not(.hero) { margin-top: clamp(3rem, 7vw, 6rem); }
.bookmark-toolbar {
  display:flex; align-items:end; justify-content:space-between; gap:2rem;
  margin:0 0 1.4rem; padding:1.2rem 0; border-bottom:1px solid var(--line);
}
.bookmark-search-wrap { display:grid; gap:.55rem; width:min(100%,520px); }
.bookmark-search-wrap > span, .bookmark-count, .bookmark-tags-label {
  color:var(--muted); font-size:.62rem; letter-spacing:.1em;
}
.bookmark-search-wrap input {
  width:100%; min-height:46px; padding:.7rem .9rem;
  border:1px solid var(--line); border-radius:3px; outline:none;
  color:var(--text); background:var(--surface); font: .9rem var(--font-display);
}
.bookmark-search-wrap input:focus { border-color:var(--accent); }
.bookmark-count { white-space:nowrap; padding-bottom:.7rem; }
.bookmark-filters, .bookmark-active-tags, .bookmark-entry-tags {
  display:flex; flex-wrap:wrap; align-items:center; gap:.5rem;
}
.bookmark-filters { margin:0 0 1rem; }
.bookmark-filter, .bookmark-tag {
  appearance:none; border:1px solid var(--line); border-radius:999px;
  padding:.48rem .8rem; color:var(--muted); background:transparent;
  font: .65rem var(--font-mono); cursor:pointer; transition:color .2s,border-color .2s,background .2s;
}
.bookmark-filter:hover, .bookmark-tag:hover,
.bookmark-filter.is-active, .bookmark-tag.is-active {
  color:var(--text); border-color:var(--accent); background:color-mix(in srgb,var(--accent) 9%,transparent);
}
.bookmark-active-tags { min-height:1.8rem; margin:0 0 1.5rem; }
.bookmark-tags-label { margin-right:.3rem; }
.bookmark-tag { padding:.32rem .62rem; font-size:.59rem; }
.bookmark-list { border-top:1px solid var(--line); }
.bookmark-entry {
  display:grid; grid-template-columns:42px minmax(0,1fr) auto; align-items:start; gap:1rem;
  padding:1.6rem .2rem; border-bottom:1px solid var(--line);
  transition:background .2s,padding .2s;
}
.bookmark-entry:hover { background:color-mix(in srgb,var(--surface) 55%,transparent); }
.bookmark-entry.is-featured { border-left:2px solid var(--accent); padding-left:1rem; }
.bookmark-number { color:var(--accent); font-size:.7rem; padding-top:.3rem; }
.bookmark-meta { color:var(--muted); font-size:.6rem; letter-spacing:.09em; margin:0 0 .55rem; }
.bookmark-entry-content > a { color:var(--text); text-decoration:none; }
.bookmark-entry-content h3 { font-size:clamp(1.15rem,2vw,1.55rem); line-height:1.25; font-weight:500; letter-spacing:-.035em; }
.bookmark-entry-content > a:hover h3 { color:var(--accent); }
.bookmark-invalid-link { color:var(--text); }
.bookmark-description { max-width:760px; margin:.5rem 0 .85rem; color:var(--muted); font-size:.9rem; }
.bookmark-entry-tags { gap:.4rem; }
.bookmark-open { align-self:center; color:var(--accent); text-decoration:none; font-size:.63rem; letter-spacing:.07em; white-space:nowrap; }
.bookmark-open:hover { text-decoration:underline; text-underline-offset:4px; }
.bookmark-image {
  grid-column:2 / 3; width:min(100%,620px); max-height:260px; margin:.2rem 0 .5rem;
  border:1px solid var(--line); border-radius:4px; object-fit:cover; object-position:center;
}
.bookmark-state { padding:2rem 0; color:var(--muted); font-size:.7rem; letter-spacing:.06em; }
:root[data-theme="light"] .bookmark-search-wrap input { background:#fff; }
:root[data-theme="light"] .bookmark-filter:hover,
:root[data-theme="light"] .bookmark-tag:hover,
:root[data-theme="light"] .bookmark-filter.is-active,
:root[data-theme="light"] .bookmark-tag.is-active {
  color:#252820; background:rgba(102,133,0,.09);
}
@media (max-width:700px) {
  .bookmark-toolbar { align-items:stretch; flex-direction:column; gap:.8rem; }
  .bookmark-count { padding:0; }
  .bookmark-entry { grid-template-columns:30px minmax(0,1fr); gap:.7rem; padding:1.25rem .1rem; }
  .bookmark-open { grid-column:2; justify-self:start; margin-top:.25rem; }
  .bookmark-image { grid-column:2; }
}


/* Bookmark tags use a deterministic color per tag, shared by filters and entries. */
.bookmark-filter, .bookmark-tag {
  --tag-ink: var(--text);
  --tag-wash: transparent;
  --tag-edge: var(--line);
  color:var(--tag-ink);
  border-color:var(--tag-edge);
  background:var(--tag-wash);
}
.bookmark-filter.tag-tone-coral, .bookmark-tag.tag-tone-coral { --tag-ink:#ff9b8f; --tag-wash:rgba(255,115,98,.105); --tag-edge:rgba(255,145,130,.38); }
.bookmark-filter.tag-tone-amber, .bookmark-tag.tag-tone-amber { --tag-ink:#f4c36e; --tag-wash:rgba(244,185,75,.105); --tag-edge:rgba(244,195,110,.38); }
.bookmark-filter.tag-tone-mint, .bookmark-tag.tag-tone-mint { --tag-ink:#8fe0b8; --tag-wash:rgba(91,207,151,.105); --tag-edge:rgba(143,224,184,.38); }
.bookmark-filter.tag-tone-blue, .bookmark-tag.tag-tone-blue { --tag-ink:#8fc8ff; --tag-wash:rgba(91,164,230,.11); --tag-edge:rgba(143,200,255,.38); }
.bookmark-filter.tag-tone-violet, .bookmark-tag.tag-tone-violet { --tag-ink:#c4a7ff; --tag-wash:rgba(157,117,238,.12); --tag-edge:rgba(196,167,255,.4); }
.bookmark-filter.tag-tone-pink, .bookmark-tag.tag-tone-pink { --tag-ink:#f0a6d1; --tag-wash:rgba(222,121,180,.11); --tag-edge:rgba(240,166,209,.4); }
.bookmark-filter.tag-tone-cyan, .bookmark-tag.tag-tone-cyan { --tag-ink:#83dce5; --tag-wash:rgba(87,196,208,.11); --tag-edge:rgba(131,220,229,.4); }
.bookmark-filter.tag-tone-lime, .bookmark-tag.tag-tone-lime { --tag-ink:#d4ff70; --tag-wash:rgba(178,220,75,.11); --tag-edge:rgba(212,255,112,.4); }
.bookmark-filter:hover, .bookmark-tag:hover,
.bookmark-filter.is-active, .bookmark-tag.is-active {
  color:var(--tag-ink);
  border-color:var(--tag-ink);
  background:var(--tag-wash);
  box-shadow:0 0 0 1px color-mix(in srgb,var(--tag-ink) 16%,transparent);
}
.bookmark-open {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.55rem;
  min-height:42px;
  padding:.7rem 1rem;
  border:1px solid var(--accent);
  border-radius:3px;
  color:var(--accent);
  background:color-mix(in srgb,var(--accent) 9%,transparent);
  font-size:.66rem;
  font-weight:500;
  letter-spacing:.055em;
  text-decoration:none;
  transition:background .2s,color .2s,transform .2s,box-shadow .2s;
}
.bookmark-open:hover, .bookmark-open:focus-visible {
  color:#11140d;
  background:var(--accent);
  box-shadow:0 5px 18px color-mix(in srgb,var(--accent) 18%,transparent);
  transform:translateY(-1px);
  text-decoration:none;
}
.bookmark-entry-content h3 { max-width:900px; }
:root[data-theme="light"] .bookmark-filter, :root[data-theme="light"] .bookmark-tag {
  filter:saturate(.9);
}
@media (max-width:700px) {
  .bookmark-open { min-height:40px; padding:.62rem .9rem; }
}


/* Featured bookmark lives in the page hero, separate from the archive list. */
.bookmark-featured-slot { margin-top:clamp(2rem,5vw,4.5rem); max-width:100%; }
.bookmark-featured-card {
  position:relative;
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(180px,32%);
  align-items:center;
  gap:clamp(1.5rem,4vw,3.5rem);
  padding:clamp(1.4rem,3.5vw,2.6rem);
  border:1px solid var(--line);
  border-left:3px solid var(--accent);
  border-radius:4px;
  background:linear-gradient(115deg,var(--surface),color-mix(in srgb,var(--surface) 55%,transparent));
}
.bookmark-featured-copy { min-width:0; }
.bookmark-featured-eyebrow { margin:0 0 1rem; color:var(--accent); font-size:.65rem; letter-spacing:.14em; }
.bookmark-featured-card h2 {
  max-width:850px;
  margin:0 0 .8rem;
  color:var(--text);
  font-size:clamp(1.5rem,3.3vw,2.7rem);
  line-height:1.08;
  letter-spacing:-.055em;
  font-weight:500;
}
.bookmark-featured-date { margin:0 0 1.1rem; color:var(--muted); font-size:.62rem; letter-spacing:.08em; }
.bookmark-featured-card .bookmark-open { margin-top:1.4rem; }
.bookmark-featured-image {
  display:block;
  width:100%;
  max-height:230px;
  aspect-ratio:4/3;
  object-fit:cover;
  border:1px solid var(--line);
  border-radius:3px;
}
@media (max-width:700px) {
  .bookmark-featured-card { grid-template-columns:1fr; gap:1.2rem; }
  .bookmark-featured-image { max-height:200px; }
}


/* Bookmarks hero: same two-column rhythm as the homepage, with a floating card. */
@media (min-width:1050px) {
  .bookmarks-page main > .hero {
    display:grid;
    grid-template-columns:minmax(0,1.1fr) minmax(300px,.9fr);
    column-gap:clamp(2rem,5vw,6rem);
    align-items:center;
    min-height:min(760px,calc(100vh - 62px));
    padding-top:clamp(3rem,6vw,5rem);
    padding-bottom:4rem;
  }
  .bookmarks-page main > .hero > .kicker,
  .bookmarks-page main > .hero > h1,
  .bookmarks-page main > .hero > .lede { grid-column:1; }
  .bookmarks-page main > .hero > .bookmark-featured-slot {
    grid-column:2;
    grid-row:1 / span 3;
    align-self:center;
    width:100%;
    max-width:440px;
    justify-self:center;
    margin:0;
    perspective:1200px;
  }
}
.bookmark-featured-card {
  position:relative;
  display:flex;
  flex-direction:column;
  gap:1.1rem;
  width:100%;
  padding:1.15rem;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.13);
  border-radius:13px;
  background:linear-gradient(145deg,#1b1e1b 0%,#111311 100%);
  color:#e8e8ea;
  box-shadow:0 24px 65px rgba(0,0,0,.38),0 5px 15px rgba(0,0,0,.18);
  transform:rotate(1.4deg) translateY(0);
  animation:bookmark-card-float 7s ease-in-out infinite;
  transition:transform .3s ease,box-shadow .3s ease,border-color .3s ease;
}
.bookmark-featured-card:hover {
  transform:rotate(0deg) translateY(-7px);
  border-color:rgba(212,255,63,.45);
  box-shadow:0 32px 75px rgba(0,0,0,.46),0 0 0 1px rgba(212,255,63,.08);
}
.bookmark-featured-topbar {
  display:flex;
  justify-content:space-between;
  gap:.7rem;
  padding:.2rem .1rem .85rem;
  border-bottom:1px solid rgba(255,255,255,.1);
  color:#8d958a;
  font-size:.58rem;
  letter-spacing:.1em;
}
.bookmark-featured-topbar span:last-child { color:#d4ff3f; }
.bookmark-featured-copy { min-width:0; padding:.15rem .1rem; }
.bookmark-featured-eyebrow {
  margin:0 0 .7rem;
  color:#d4ff3f;
  font-size:.62rem;
  letter-spacing:.12em;
}
.bookmark-featured-card h2 {
  max-width:100%;
  margin:0 0 .8rem;
  color:#f0f1ed;
  font-size:clamp(1.35rem,2vw,1.8rem);
  line-height:1.18;
  letter-spacing:-.045em;
  font-weight:600;
  overflow-wrap:anywhere;
}
.bookmark-featured-date {
  margin:0 0 .9rem;
  color:#969c92;
  font-size:.62rem;
  letter-spacing:.08em;
}
.bookmark-featured-footer {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  padding-top:.9rem;
  border-top:1px solid rgba(255,255,255,.1);
}
.bookmark-featured-footer > span {
  color:#8d958a;
  font-size:.56rem;
  letter-spacing:.08em;
}
.bookmark-featured-card .bookmark-open {
  margin:0;
  min-height:36px;
  padding:.55rem .85rem;
  font-size:.62rem;
  border-radius:4px;
}
.bookmark-featured-image {
  order:2;
  display:block;
  width:100%;
  max-height:190px;
  aspect-ratio:16/9;
  object-fit:cover;
  border:1px solid rgba(255,255,255,.12);
  border-radius:7px;
}
.bookmark-featured-card:has(.bookmark-featured-image) .bookmark-featured-image { order:1; }
@keyframes bookmark-card-float {
  0%,100% { translate:0 0; }
  50% { translate:0 -8px; }
}
:root[data-theme="light"] .bookmark-featured-card {
  background:linear-gradient(145deg,#fff 0%,#f3f5ee 100%);
  color:#252820;
  border-color:#d9ddd2;
  box-shadow:0 24px 60px rgba(35,42,24,.13),0 4px 12px rgba(35,42,24,.06);
}
:root[data-theme="light"] .bookmark-featured-topbar,
:root[data-theme="light"] .bookmark-featured-footer { border-color:#e1e5dc; }
:root[data-theme="light"] .bookmark-featured-topbar,
:root[data-theme="light"] .bookmark-featured-footer > span,
:root[data-theme="light"] .bookmark-featured-date { color:#73796a; }
:root[data-theme="light"] .bookmark-featured-card h2 { color:#252820; }
@media (max-width:1049px) {
  .bookmarks-page main > .hero { display:flex; flex-direction:column; align-items:stretch; }
  .bookmarks-page main > .hero > .bookmark-featured-slot { width:min(100%,440px); margin:1rem auto 3rem; }
  .bookmark-featured-card { transform:rotate(.7deg); }
}
@media (max-width:600px) {
  .bookmarks-page main > .hero > .bookmark-featured-slot { width:100%; }
  .bookmark-featured-card { padding:1rem; }
  .bookmark-featured-footer { align-items:flex-start; flex-direction:column; }
}
@media (prefers-reduced-motion:reduce) {
  .bookmark-featured-card { animation:none; }
}


/* Unlimited deterministic tag hues: each distinct tag receives its own color. */
.bookmark-filter[style*="--bookmark-tag-hue"],
.bookmark-tag[style*="--bookmark-tag-hue"] {
  color:hsl(var(--bookmark-tag-hue) 82% 72%);
  border-color:hsl(var(--bookmark-tag-hue) 75% 65% / .48);
  background:hsl(var(--bookmark-tag-hue) 78% 55% / .11);
}
.bookmark-filter[style*="--bookmark-tag-hue"]:hover,
.bookmark-tag[style*="--bookmark-tag-hue"]:hover,
.bookmark-filter[style*="--bookmark-tag-hue"].is-active,
.bookmark-tag[style*="--bookmark-tag-hue"].is-active {
  color:hsl(var(--bookmark-tag-hue) 88% 78%);
  border-color:hsl(var(--bookmark-tag-hue) 82% 68%);
  background:hsl(var(--bookmark-tag-hue) 78% 55% / .19);
}
:root[data-theme="light"] .bookmark-filter[style*="--bookmark-tag-hue"],
:root[data-theme="light"] .bookmark-tag[style*="--bookmark-tag-hue"] {
  color:hsl(var(--bookmark-tag-hue) 72% 34%);
  border-color:hsl(var(--bookmark-tag-hue) 62% 43% / .5);
  background:hsl(var(--bookmark-tag-hue) 70% 45% / .09);
}
:root[data-theme="light"] .bookmark-filter[style*="--bookmark-tag-hue"]:hover,
:root[data-theme="light"] .bookmark-tag[style*="--bookmark-tag-hue"]:hover,
:root[data-theme="light"] .bookmark-filter[style*="--bookmark-tag-hue"].is-active,
:root[data-theme="light"] .bookmark-tag[style*="--bookmark-tag-hue"].is-active {
  color:hsl(var(--bookmark-tag-hue) 78% 27%);
  border-color:hsl(var(--bookmark-tag-hue) 68% 38%);
  background:hsl(var(--bookmark-tag-hue) 72% 45% / .14);
}
/* The global light-theme .btn-primary rule uses white text; bookmark buttons
   need dark text on the lime background for accessible contrast. */
:root[data-theme="light"] .bookmark-open,
:root[data-theme="light"] .bookmark-open.btn-primary {
  color:#202516 !important;
}
:root[data-theme="light"] .bookmark-open:hover,
:root[data-theme="light"] .bookmark-open:focus-visible,
:root[data-theme="light"] .bookmark-open.btn-primary:hover {
  color:#202516 !important;
}


/* Light theme: invert the bookmark CTA text on hover for a clearer interaction. */
:root[data-theme="light"] .bookmark-open:hover,
:root[data-theme="light"] .bookmark-open:focus-visible,
:root[data-theme="light"] .bookmark-open.btn-primary:hover {
  color:#ffffff !important;
}

/* Homepage-style full-card dragging for the featured bookmark. */
.bookmark-featured-card { --drag-x:0px; --drag-y:0px; touch-action:none; cursor:grab; transform:translate3d(var(--drag-x),var(--drag-y),0) rotate(var(--tilt,1.4deg)); will-change:transform,translate; user-select:none; }
.bookmark-featured-card.is-dragging { z-index:20; animation-play-state:paused; transition:none; cursor:grabbing; border-color:rgba(212,255,63,.7); box-shadow:0 28px 70px rgba(0,0,0,.48),0 0 0 1px rgba(212,255,63,.16); }
.bookmark-drag-handle { cursor:grab; user-select:none; touch-action:none; }
.bookmark-featured-card.is-dragging .bookmark-drag-handle { cursor:grabbing; }
.bookmark-featured-card a, .bookmark-featured-card button { cursor:pointer; }
.bookmark-featured-image { -webkit-user-drag:none; }

/* Give bookmark titles and their taxonomy a deliberate visual separation. */
.bookmark-entry-content h3 {
  margin:0;
  max-width:980px;
  line-height:1.18;
  text-wrap:pretty;
}
.bookmark-entry .bookmark-entry-tags {
  margin-top:1.15rem;
  padding-top:.9rem;
  gap:.55rem;
}
.bookmark-entry .bookmark-tag {
  padding:.38rem .72rem;
  font-size:.62rem;
  line-height:1.2;
}
.bookmark-entry .bookmark-meta {
  margin-bottom:.7rem;
}
@media (max-width:700px) {
  .bookmark-entry .bookmark-entry-tags {
    margin-top:1rem;
    padding-top:.75rem;
  }
}


/* Light-mode contrast pass for the floating featured bookmark. */
:root[data-theme="light"] .bookmark-featured-card {
  color:#20251a;
  background:linear-gradient(145deg,#ffffff 0%,#f7f9f1 100%);
  border-color:#d6ddc9;
}
:root[data-theme="light"] .bookmark-featured-card .bookmark-featured-topbar,
:root[data-theme="light"] .bookmark-featured-card .bookmark-featured-footer > span {
  color:#59634c;
}
:root[data-theme="light"] .bookmark-featured-card .bookmark-featured-topbar span:last-child,
:root[data-theme="light"] .bookmark-featured-card .bookmark-featured-eyebrow {
  color:#557600;
}
:root[data-theme="light"] .bookmark-featured-card h2 {
  color:#20251a;
}
:root[data-theme="light"] .bookmark-featured-card .bookmark-featured-date {
  color:#59634c;
}
:root[data-theme="light"] .bookmark-featured-card .bookmark-tag {
  filter:saturate(1.15);
  font-weight:500;
}
:root[data-theme="light"] .bookmark-featured-card .bookmark-open,
:root[data-theme="light"] .bookmark-featured-card .bookmark-open.btn-primary {
  color:#20251a !important;
  background:#d4ff3f !important;
  border:1px solid #91b51c !important;
  box-shadow:0 8px 20px rgba(73,103,0,.12);
}
:root[data-theme="light"] .bookmark-featured-card .bookmark-open:hover,
:root[data-theme="light"] .bookmark-featured-card .bookmark-open:focus-visible,
:root[data-theme="light"] .bookmark-featured-card .bookmark-open.btn-primary:hover {
  color:#ffffff !important;
  background:#557600 !important;
  border-color:#557600 !important;
}


/* Match the homepage floating-project CTA in light mode: quiet outline by
   default, then the site's established olive accent with white hover text. */
:root[data-theme="light"] .bookmark-featured-card .bookmark-open,
:root[data-theme="light"] .bookmark-featured-card .bookmark-open.btn-primary {
  color:var(--accent) !important;
  background:transparent !important;
  border:1px solid rgba(102,133,0,.55) !important;
  box-shadow:none !important;
}
:root[data-theme="light"] .bookmark-featured-card .bookmark-open:hover,
:root[data-theme="light"] .bookmark-featured-card .bookmark-open:focus-visible,
:root[data-theme="light"] .bookmark-featured-card .bookmark-open.btn-primary:hover {
  color:#ffffff !important;
  background:var(--accent) !important;
  border-color:var(--accent) !important;
}


/* Blog hero: editorial copy paired with a draggable textbook-paper note. */
.blog-page .blog-hero {
  display:grid;
  grid-template-columns:minmax(0,1.1fr) minmax(300px,.9fr);
  align-items:center;
  gap:clamp(2rem,6vw,6rem);
  min-height:clamp(430px,48vw,620px);
  padding-bottom:clamp(3rem,7vw,6rem);
}
.blog-hero-copy { min-width:0; }
.blog-quote-stage {
  position:relative;
  display:grid;
  place-items:center;
  min-height:360px;
  overflow:visible;
  perspective:1000px;
}
.blog-quote-card {
  --drag-x:0px;
  --drag-y:0px;
  width:min(100%,390px);
  position:relative;
  z-index:1;
  transform:translate3d(var(--drag-x),var(--drag-y),0) rotate(-3deg);
  animation:blog-paper-float 7s ease-in-out infinite;
  transition:box-shadow .25s,border-color .25s;
  border:1px solid rgba(91,96,69,.24);
  border-radius:4px;
  background:#f2f0e6;
  color:#25271f;
  box-shadow:0 24px 55px rgba(0,0,0,.24),0 3px 9px rgba(0,0,0,.1);
  overflow:hidden;
  will-change:transform;
  user-select:none;
}
.blog-quote-card.is-dragging {
  z-index:20;
  animation-play-state:paused;
  transition:none;
  cursor:grabbing;
  box-shadow:0 32px 70px rgba(0,0,0,.34),0 0 0 1px rgba(212,255,63,.3);
}
.blog-quote-handle {
  display:flex;
  align-items:center;
  gap:.65rem;
  min-height:38px;
  padding:.65rem .9rem;
  color:#69705d;
  background:#e8e6d9;
  border-bottom:1px solid rgba(77,84,58,.18);
  font-size:.58rem;
  letter-spacing:.1em;
  cursor:grab;
  touch-action:none;
}
.blog-quote-handle span:nth-child(2) { margin-right:auto; }
.blog-quote-handle span:last-child { color:#718b19; }
.blog-quote-paper {
  min-height:280px;
  padding:clamp(1.5rem,3vw,2.1rem);
  position:relative;
  background-color:#f4f2e8;
  background-image:repeating-linear-gradient(to bottom,transparent 0,transparent 31px,rgba(91,112,83,.12) 32px,transparent 33px);
}
.blog-quote-paper::before {
  content:"";
  position:absolute;
  top:0;bottom:0;left:2.2rem;
  width:1px;
  background:rgba(180,92,76,.35);
}
.blog-quote-kicker {
  display:block;
  color:#78805f;
  font-size:.58rem;
  letter-spacing:.16em;
  margin:0 0 2rem .9rem;
}
.blog-quote-paper blockquote {
  position:relative;
  margin:0 0 2.5rem 1rem;
  max-width:15ch;
  color:#e8e8ea;
  font-family:var(--font-display);
  font-size:clamp(1.65rem,3vw,2.25rem);
  font-weight:600;
  line-height:1.28;
  letter-spacing:-.045em;
}
.blog-quote-footer {
  display:flex;
  justify-content:space-between;
  gap:1rem;
  margin-left:1rem;
  padding-top:1rem;
  border-top:1px solid rgba(77,84,58,.2);
  color:#7b806e;
  font-size:.53rem;
  letter-spacing:.1em;
}
@keyframes blog-paper-float {
  0%,100% { translate:0 0; }
  50% { translate:0 -9px; }
}
@media (max-width:900px) {
  .blog-page .blog-hero { grid-template-columns:1fr; gap:1rem; min-height:0; }
  .blog-quote-stage { min-height:330px; justify-content:center; }
  .blog-quote-card { width:min(86%,390px); }
}
@media (prefers-reduced-motion:reduce) {
  .blog-quote-card { animation:none; }
}


/* Dark-mode textbook paper: retain the notebook details without the light
   paper becoming a bright, disconnected object on the dark portfolio. */
.blog-quote-card {
  background:#17191a;
  color:var(--text);
  border-color:#343831;
  box-shadow:0 24px 55px rgba(0,0,0,.42),0 3px 9px rgba(0,0,0,.24);
}
.blog-quote-handle {
  color:#a0a493;
  background:#202321;
  border-bottom-color:#353a30;
}
.blog-quote-handle span:last-child { color:var(--accent); }
.blog-quote-paper {
  background-color:#191c1b;
  background-image:repeating-linear-gradient(to bottom,transparent 0,transparent 31px,rgba(211,224,190,.075) 32px,transparent 33px);
}
.blog-quote-paper::before { background:rgba(212,255,63,.25); }
.blog-quote-kicker { color:#a2aa8c; }
.blog-quote-paper blockquote { color:#e8e8ea; }
.blog-quote-footer {
  color:#9ba18d;
  border-top-color:rgba(211,224,190,.17);
}

/* Light theme keeps the original warm paper treatment, using site typography. */
:root[data-theme="light"] .blog-quote-card {
  background:#f2f0e6;
  color:#25271f;
  border-color:rgba(91,96,69,.24);
  box-shadow:0 24px 55px rgba(0,0,0,.14),0 3px 9px rgba(0,0,0,.06);
}
:root[data-theme="light"] .blog-quote-handle {
  color:#69705d;
  background:#e8e6d9;
  border-bottom-color:rgba(77,84,58,.18);
}
:root[data-theme="light"] .blog-quote-handle span:last-child { color:#718b19; }
:root[data-theme="light"] .blog-quote-paper {
  background-color:#f4f2e8;
  background-image:repeating-linear-gradient(to bottom,transparent 0,transparent 31px,rgba(91,112,83,.12) 32px,transparent 33px);
}
:root[data-theme="light"] .blog-quote-paper::before { background:rgba(180,92,76,.35); }
:root[data-theme="light"] .blog-quote-kicker { color:#78805f; }
:root[data-theme="light"] .blog-quote-paper blockquote { color:#282b22; }
:root[data-theme="light"] .blog-quote-footer {
  color:#7b806e;
  border-top-color:rgba(77,84,58,.2);
}


/* ---------- Recent Jams: three tactile, draggable collection cards ---------- */
.recent-jams-workspace {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: clamp(1rem, 2.5vw, 2rem);
  padding: 1.4rem .35rem 2.5rem;
  isolation: isolate;
}
.jam-card {
  --jam-x: 0px;
  --jam-y: 0px;
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 42px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.12);
  transform: translate3d(var(--jam-x),var(--jam-y),0) rotate(var(--jam-tilt,0deg));
  animation: jam-card-float 6.8s ease-in-out infinite;
  animation-delay: var(--jam-delay,0s);
  transition: box-shadow .22s ease, border-color .22s ease;
  will-change: transform;
}
.jam-card:nth-child(2) { margin-top: 2.2rem; }
.jam-card:nth-child(3) { margin-top: .8rem; }
@keyframes jam-card-float {
  0%,100% { translate: 0 0; }
  50% { translate: 0 -9px; }
}
.jam-card.is-dragging {
  z-index: 20 !important;
  animation-play-state: paused;
  transition: none;
  border-color: var(--accent);
  box-shadow: 0 26px 60px rgba(0,0,0,.36), 0 0 0 1px color-mix(in srgb,var(--accent) 24%,transparent);
}
.jam-card-handle {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:.5rem;
  min-height:39px;
  padding:.55rem .8rem;
  border:0;
  border-bottom:1px solid var(--line);
  background:color-mix(in srgb,var(--surface) 82%,var(--text) 5%);
  color:var(--muted);
  font: .62rem/1.2 var(--font-mono);
  letter-spacing:.09em;
  cursor:grab;
  user-select:none;
  touch-action:none;
}
.jam-card-handle:focus-visible { outline:2px solid var(--accent); outline-offset:-3px; }
.jam-card.is-dragging .jam-card-handle { cursor:grabbing; }
.jam-card-handle span:last-child { color:var(--accent); }
.jam-card-visual {
  position:relative;
  display:grid;
  place-items:center;
  min-height:190px;
  overflow:hidden;
  background:#242722;
  color:#e9eadf;
}
.jam-card-visual img {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
}
.jam-card.has-artwork .jam-card-visual::after {
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(180deg,transparent 45%,rgba(0,0,0,.4));
  pointer-events:none;
}
.jam-card-motif { font:500 clamp(4rem,8vw,6.5rem)/1 var(--font-display); opacity:.9; }
.jam-card-stamp {
  position:absolute;
  left:1rem;
  bottom:.85rem;
  z-index:1;
  color:rgba(255,255,255,.78);
  font-size:.57rem;
  letter-spacing:.12em;
}
.jam-card--book .jam-card-visual { background:linear-gradient(140deg,#5c6748,#28372f 72%); }
.jam-card--book .jam-card-motif { font-family:Georgia,serif; font-style:italic; }
.jam-card--song .jam-card-visual { background:radial-gradient(circle at 50% 48%,#b1a06b 0 3%,#333b35 3.5% 17%,#1d2523 17.5% 30%,#31372d 30.5% 31%,#202522 31.5%); }
.jam-card--song .jam-card-motif { font-size:4.6rem; text-shadow:0 5px 22px rgba(0,0,0,.35); }
.jam-card--movie .jam-card-visual { background:linear-gradient(145deg,#5a4540,#29282a 72%); }
.jam-card--movie .jam-card-motif { font-size:4.8rem; border:1px solid rgba(255,255,255,.38); border-radius:50%; width:104px;height:104px;display:grid;place-items:center;padding-left:8px; }
.jam-card-body { padding:1.05rem 1.1rem .85rem; }
.jam-card-kind { margin-bottom:.45rem; color:var(--accent); font-size:.61rem; letter-spacing:.13em; text-transform:uppercase; }
.jam-card-body h3 { font-size:clamp(1.12rem,1.8vw,1.45rem); line-height:1.18; letter-spacing:-.045em; font-weight:600; overflow-wrap:anywhere; }
.jam-card-creator { margin-top:.5rem; color:var(--muted); font: .72rem/1.5 var(--font-mono); }
.jam-card-detail { margin-top:.65rem; color:var(--muted); font-size:.82rem; line-height:1.55; }
.jam-card-footer {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:.8rem;
  padding:.75rem 1.1rem .9rem;
  border-top:1px solid var(--line);
  color:var(--muted);
  font-size:.58rem;
  letter-spacing:.08em;
}
.jam-card-link { color:var(--accent); text-decoration:none; white-space:nowrap; }
.jam-card-link:hover { text-decoration:underline; }
.recent-jams-hint,.recent-jams-loading,.recent-jams-empty {
  color:var(--muted);
  font: .65rem/1.5 var(--font-mono);
  letter-spacing:.1em;
}
.recent-jams-hint { text-align:right; margin-top:-.7rem; }
.recent-jams-loading,.recent-jams-empty { grid-column:1/-1; padding:2rem 0; }
:root[data-theme="light"] .jam-card {
  background:#fff;
  border-color:#d9ddd2;
  color:#252820;
  box-shadow:0 18px 42px rgba(35,42,24,.12),0 2px 8px rgba(35,42,24,.05);
}
:root[data-theme="light"] .jam-card-handle {
  color:#62685a;
  background:#edf0e8;
  border-bottom-color:#dfe3d8;
}
:root[data-theme="light"] .jam-card-handle span:last-child,
:root[data-theme="light"] .jam-card-kind,
:root[data-theme="light"] .jam-card-link { color:#668500; }
:root[data-theme="light"] .jam-card-body h3 { color:#252820; }
:root[data-theme="light"] .jam-card-creator,
:root[data-theme="light"] .jam-card-detail,
:root[data-theme="light"] .jam-card-footer { color:#73796a; }
@media (max-width: 760px) {
  .recent-jams-workspace { grid-template-columns:1fr; gap:1.5rem; padding-inline:1rem; }
  .jam-card { width:min(100%,420px); justify-self:center; }
  .jam-card:nth-child(2),.jam-card:nth-child(3) { margin-top:0; }
  .jam-card-visual { min-height:220px; }
}
@media (prefers-reduced-motion: reduce) {
  .jam-card { animation:none; }
}


/* Recent Jams drag interaction reliability */
#recent-jams-workspace { overflow: visible; }
#recent-jams-workspace .jam-card-handle {
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#recent-jams-workspace .jam-card-handle.is-grabbed,
#recent-jams-workspace .jam-card.is-dragging .jam-card-handle { cursor: grabbing; }
#recent-jams-workspace .jam-card.is-dragging { animation: none; }
#recent-jams-workspace .jam-card-handle * {
  pointer-events: none;
  -webkit-user-drag: none;
}


/* Drag the whole Recent Jams card surface, not only its header */
#recent-jams-workspace .jam-card {
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#recent-jams-workspace .jam-card.is-dragging { cursor: grabbing; }
#recent-jams-workspace .jam-card a {
  cursor: pointer;
  -webkit-user-drag: none;
}
#recent-jams-workspace .jam-card img {
  -webkit-user-drag: none;
  pointer-events: none;
}


/* Bring the featured bookmark's movement in line with homepage project cards. */
.bookmark-featured-card {
  --drag-x:0px;
  --drag-y:0px;
  transform:translate3d(var(--drag-x),var(--drag-y),0) rotate(-2deg);
  animation:bookmark-featured-float 6.5s ease-in-out infinite;
  will-change:transform;
  transition:box-shadow .25s ease,border-color .25s ease;
  cursor:grab;
}
@keyframes bookmark-featured-float {
  0%,100% { translate:0 0; }
  50% { translate:0 -9px; }
}
.bookmark-featured-card.is-dragging {
  z-index:20;
  animation-play-state:paused;
  transition:none;
  border-color:rgba(212,255,63,.7);
  box-shadow:0 28px 70px rgba(0,0,0,.48),0 0 0 1px rgba(212,255,63,.16);
  cursor:grabbing;
}
.bookmark-featured-card .bookmark-featured-topbar {
  cursor:grab;
  touch-action:none;
}
.bookmark-featured-card.is-dragging .bookmark-featured-topbar { cursor:grabbing; }
.bookmark-featured-card img { pointer-events:none; user-select:none; }
@media (prefers-reduced-motion:reduce) {
  .bookmark-featured-card { animation:none; }
}


/* Keep the pointer offset in every card state. The old hover transform
   replaced the drag transform, making the card snap back on release. */
.bookmark-featured-card,
.bookmark-featured-card:hover,
.bookmark-featured-card.is-dragging,
.bookmark-featured-card.is-dragging:hover {
  transform:translate3d(var(--drag-x,0px),var(--drag-y,0px),0) rotate(var(--bookmark-card-rotation,-2deg));
}
.bookmark-featured-card:hover {
  --bookmark-card-rotation:0deg;
}
.bookmark-featured-card.is-dragging,
.bookmark-featured-card.is-dragging:hover {
  --bookmark-card-rotation:-2deg;
  animation-play-state:paused;
  transition:none;
}
.bookmark-featured-card {
  touch-action:pan-y;
}
.bookmark-featured-card img {
  -webkit-user-drag:none;
}


/* Homepage hero card switcher */
.hero-next-card {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:.55rem;
  margin:.45rem auto 0;
  padding:.42rem .75rem;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
  color:var(--muted);
  font:500 .62rem/1.2 var(--font-mono);
  letter-spacing:.06em;
  cursor:pointer;
  transition:color .2s,border-color .2s,background .2s,transform .2s;
}
.hero-next-card:hover,.hero-next-card:focus-visible {
  color:var(--text);
  border-color:var(--accent);
  background:var(--surface-2,var(--surface));
}
.hero-next-card:active { transform:translateY(1px); }
.hero-next-card:disabled { opacity:.45; cursor:default; }
.hero-rotating-card { cursor:grab; }
.hero-rotating-card.is-dragging { cursor:grabbing; }
.hero-rotating-visual {
  display:grid;
  place-items:center;
  min-height:205px;
  max-height:235px;
  overflow:hidden;
  background:var(--surface);
}
.hero-rotating-visual img { width:100%;height:220px;object-fit:cover;display:block;pointer-events:none; }
.hero-rotating-visual span { font:700 5rem/1 var(--font-display);color:var(--accent); }
.hero-quote-rotating .blog-quote-paper { min-height:300px; }
.hero-quote-rotating .blog-quote-paper blockquote { color:#25271f; }
:root[data-theme="dark"] .hero-quote-rotating .blog-quote-paper blockquote { color:#e8e8ea; }
@media (max-width:600px) {
  .hero-next-card { margin-top:.55rem; }
}


/* Hero versions of Recent Jams preserve the full card content hierarchy. */
.hero-jam-card { display:flex; flex-direction:column; }
.hero-jam-visual {
  position:relative;
  display:grid;
  place-items:center;
  min-height:190px;
  max-height:220px;
  overflow:hidden;
  background:var(--surface);
}
.hero-jam-visual img {
  display:block;
  width:100%;
  height:210px;
  object-fit:cover;
  pointer-events:none;
}
.hero-jam-visual .jam-card-stamp {
  position:absolute;
  right:.8rem;
  bottom:.7rem;
  z-index:1;
}
.hero-jam-card .jam-card-body { padding:1rem 1.1rem .8rem; }
.hero-jam-card .jam-card-kind {
  margin:0 0 .45rem;
  color:var(--accent);
  font-size:.58rem;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.hero-jam-card .jam-card-body h3 {
  margin:0;
  color:var(--text);
  font-size:1.35rem;
  line-height:1.12;
  letter-spacing:-.04em;
}
.hero-jam-card .jam-card-creator,
.hero-jam-card .jam-card-detail {
  margin:.45rem 0 0;
  color:var(--muted);
  font-size:.78rem;
  line-height:1.5;
}
.hero-jam-card .jam-card-footer {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:.75rem;
  margin-top:auto;
  padding:.8rem 1.1rem;
  border-top:1px solid var(--line);
  color:var(--muted);
  font-size:.58rem;
  letter-spacing:.08em;
}
.hero-jam-card .jam-card-link {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:.45rem .7rem;
  border:1px solid var(--line);
  border-radius:4px;
  color:var(--text);
  text-decoration:none;
  transition:background .2s,border-color .2s,color .2s;
}
.hero-jam-card .jam-card-link:hover { background:var(--accent);border-color:var(--accent);color:#171914; }

.hero-bookmark-card { display:flex;flex-direction:column;gap:1rem;padding:1rem 1.1rem 1.1rem; }
.hero-bookmark-copy { min-width:0; }
.hero-bookmark-copy h3 {
  margin:0 0 .7rem;
  color:var(--text);
  font-size:clamp(1.35rem,2vw,1.8rem);
  line-height:1.18;
  letter-spacing:-.045em;
  overflow-wrap:anywhere;
}
.hero-bookmark-date { margin:0 0 .8rem;color:var(--muted);font-size:.62rem;letter-spacing:.08em; }
.hero-bookmark-tags { display:flex;flex-wrap:wrap;gap:.45rem; }
.hero-bookmark-tags .bookmark-tag { pointer-events:none; }
.hero-bookmark-footer {
  display:flex;align-items:center;justify-content:space-between;gap:.8rem;
  padding-top:.8rem;border-top:1px solid var(--line);
}
.hero-bookmark-footer > span { color:var(--muted);font-size:.56rem;letter-spacing:.08em; }
.hero-bookmark-image {
  display:block;width:100%;max-height:170px;aspect-ratio:16/9;object-fit:cover;
  border:1px solid var(--line);border-radius:6px;pointer-events:none;
}

/* Keep the rotating bookmark card's eyebrow as legible as the page's
   original featured bookmark in light mode. */
:root[data-theme="light"] .hero-bookmark-card .bookmark-featured-eyebrow {
  color:#557600;
}


/* ---------- usability and responsive polish (visual system preserved) ---------- */
:root {
  text-rendering: optimizeLegibility;
  font-synthesis: none;
}
body { line-height: 1.65; }
section[id], main[id], .article-shell { scroll-margin-top: 6rem; }

/* Clear keyboard focus without changing the site's visual language. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
:where(button, input, select, textarea) { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* Slightly more comfortable reading for small editorial labels. */
.kicker, .article-meta, .blog-entry-meta, .bookmark-meta,
.bookmark-featured-date, .hero-preview-hint, .workspace-hint {
  line-height: 1.55;
}
.bookmark-meta, .article-meta, .blog-entry-meta { font-size: max(.7rem, .68em); }
.bookmark-entry .bookmark-tag { font-size: .68rem; }
.bookmark-entry .bookmark-entry-tags { row-gap: .65rem; }

/* Keep the six-item navigation readable on narrow screens. */
@media (max-width: 760px) {
  .site-header {
    flex-wrap: wrap;
    row-gap: .55rem;
    padding-top: .7rem;
    padding-bottom: .7rem;
  }
  .site-header nav {
    order: 3;
    flex: 1 0 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: .25rem .9rem;
    min-width: 0;
  }
  .site-header nav a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    font-size: .74rem;
  }
  .site-header > .status {
    margin-left: auto;
    font-size: .62rem;
  }
}
@media (max-width: 480px) {
  .site-header { padding-left: 1rem; padding-right: 1rem; }
  .site-header > .status .status-label { display: none; }
  .site-header > .status { gap: .25rem; }
  .site-header nav { column-gap: .8rem; row-gap: .15rem; }
  main { padding-left: 1.1rem; padding-right: 1.1rem; }
  section { padding-top: clamp(3.5rem, 12vw, 4.5rem); padding-bottom: clamp(3.5rem, 12vw, 4.5rem); }
  .hero { padding-top: 3.75rem; }
  .section-head { gap: .8rem; margin-bottom: 1.8rem; }
  .section-head h2 { font-size: .82rem; }
  .floating-controls { bottom: max(.75rem, env(safe-area-inset-bottom)); right: max(.75rem, env(safe-area-inset-right)); }
}
@media (max-width: 360px) {
  .logo { font-size: .9rem; }
  .site-header nav { column-gap: .65rem; }
  .site-header nav a { font-size: .69rem; }
}

/* Give anchor destinations breathing room below the sticky header. */
:target { scroll-margin-top: 6rem; }


/* Combined Substack article labels and original-source link */
.blog-publication,
.article-publication {
  display: inline-flex;
  align-self: flex-start;
  width: fit-content;
  color: var(--accent);
  font: .62rem/1.5 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.article-publication { margin-top: .2rem; }
.article-original-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 2rem;
  padding: .65rem .85rem;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .7rem;
  text-decoration: none;
}
.article-original-link:hover { color: var(--accent); border-color: var(--accent); }


/* ---------- Keep hero feature cards beside their copy at narrow widths ---------- */
/* The hero switches to a compact two-column layout instead of stacking the
   featured interaction below the introduction. The text remains first. */
@media (min-width: 360px) and (max-width: 1049px) {
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .9fr);
    column-gap: clamp(.65rem, 2.4vw, 1.4rem);
    align-items: center;
    min-height: 0;
    padding-top: clamp(2.5rem, 7vw, 4rem);
    padding-bottom: 3rem;
  }
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero > .kicker,
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero > h1,
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero > .lede,
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero > .hero-actions {
    grid-column: 1;
    min-width: 0;
  }
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero > .hero-preview-wrap {
    grid-column: 2;
    grid-row: 1 / span 4;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
  }
  .hero-preview-workspace {
    min-height: clamp(190px, 42vw, 330px);
    padding: .2rem;
  }
  .hero-preview-workspace .floating-project {
    width: 100%;
    max-width: 100%;
  }
  .hero-preview-hint { font-size: clamp(.46rem, 1.25vw, .6rem); }
  .hero-next-card { font-size: clamp(.55rem, 1.4vw, .68rem); }

  .blog-page .blog-hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .9fr);
    column-gap: clamp(.65rem, 2.4vw, 1.4rem);
    row-gap: 0;
    align-items: center;
    min-height: 0;
    padding-top: clamp(2.5rem, 7vw, 4rem);
    padding-bottom: 3rem;
  }
  .blog-hero-copy { grid-column: 1; min-width: 0; }
  .blog-quote-stage {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: clamp(190px, 38vw, 300px);
    height: 100%;
  }
  .blog-quote-card { width: 100%; max-width: 390px; }
  .blog-quote-handle { gap: .35rem; padding-inline: .55rem; font-size: .5rem; }
  .blog-quote-paper { padding: 1rem .65rem; }
  .blog-quote-kicker { margin: 0 0 1rem .45rem; font-size: .48rem; }
  .blog-quote-paper blockquote {
    margin: 0 0 1.2rem .5rem;
    font-size: clamp(.95rem, 2.5vw, 1.5rem);
  }
  .blog-quote-footer { margin-left: .5rem; padding-top: .6rem; font-size: .4rem; }

  .bookmarks-page main > .hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .9fr);
    column-gap: clamp(.65rem, 2.4vw, 1.4rem);
    align-items: center;
    min-height: 0;
    padding-top: clamp(2.5rem, 7vw, 4rem);
    padding-bottom: 3rem;
  }
  .bookmarks-page main > .hero > .kicker,
  .bookmarks-page main > .hero > h1,
  .bookmarks-page main > .hero > .lede { grid-column: 1; min-width: 0; }
  .bookmarks-page main > .hero > .bookmark-featured-slot {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    justify-self: stretch;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    perspective: 800px;
  }
  .bookmark-featured-card { padding: clamp(.55rem, 1.8vw, 1rem); gap: .65rem; }
  .bookmark-featured-image { max-height: 110px; }
  .bookmark-featured-card h2 { font-size: clamp(.85rem, 2.3vw, 1.2rem); }
  .bookmark-featured-footer { gap: .4rem; }
}

@media (max-width: 600px) {
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero h1,
  .blog-page .blog-hero h1,
  .bookmarks-page main > .hero h1 {
    font-size: clamp(1.55rem, 5.8vw, 2.25rem);
    line-height: 1.08;
    letter-spacing: -.045em;
    overflow-wrap: anywhere;
  }
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero .lede,
  .blog-page .blog-hero .lede,
  .bookmarks-page main > .hero .lede {
    font-size: clamp(.72rem, 2.6vw, .9rem);
    line-height: 1.5;
    margin-bottom: .8rem;
    overflow-wrap: anywhere;
  }
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero .kicker,
  .blog-page .blog-hero .kicker,
  .bookmarks-page main > .hero .kicker {
    font-size: clamp(.55rem, 2vw, .72rem);
    margin-bottom: .65rem;
  }
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero .hero-actions {
    gap: .4rem;
    margin-bottom: .5rem;
  }
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero .hero-actions .btn {
    padding: .45rem .55rem;
    font-size: .58rem;
  }
}

@media (max-width: 359px) {
  /* Extremely narrow devices still retain the requested side-by-side layout. */
  body:not(.work-page):not(.blog-page):not(.bookmarks-page) main > .hero,
  .blog-page .blog-hero,
  .bookmarks-page main > .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .82fr);
    column-gap: .5rem;
    align-items: center;
  }
  .hero-preview-workspace { min-height: 165px; }
  .blog-quote-stage { min-height: 165px; }
  .bookmark-featured-card { padding: .45rem; }
  .blog-quote-footer { display: none; }
}


/* Make the floating music control visibly reflect playback state in both themes. */
.floating-controls .music-toggle[aria-pressed="true"] {
  color: #171a12;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,255,63,.16), 0 0 16px rgba(212,255,63,.28);
}
:root[data-theme="light"] .floating-controls .music-toggle[aria-pressed="true"] {
  color: #172014;
  border-color: #a9c83a;
  background: #c9e66b;
  box-shadow: 0 0 0 3px rgba(126,157,42,.14), 0 0 14px rgba(126,157,42,.2);
}
.floating-controls .music-toggle[aria-pressed="true"] span {
  animation: music-active-pulse 1.8s ease-in-out infinite;
}
@keyframes music-active-pulse {
  0%, 100% { transform: translateY(-1px) scale(1); }
  50% { transform: translateY(-1px) scale(1.12); }
}
@media (prefers-reduced-motion: reduce) {
  .floating-controls .music-toggle[aria-pressed="true"] span { animation: none; }
}
