:root {
  --black: #050611;
  --deep: #0a0d1e;
  /* Dark tokens — used by the showcase/content cards */
  --panel: rgba(13, 17, 42, 0.78);
  --panel-strong: rgba(18, 24, 58, 0.92);
  --line: rgba(170, 188, 255, 0.16);
  --line-strong: rgba(170, 188, 255, 0.32);
  --text: #f5f7ff;
  --muted: #a3accf;
  --subtle: #68739e;
  --blue: #64a8ff;
  --green: #4de2d0;
  --purple: #966dff;
  --pink: #ff75d8;
  --shadow: 0 30px 90px rgba(0, 0, 18, 0.48);
  /* Light tokens — used by the page chrome (shell, topbar, section wrappers, footer) */
  --l-ink: #1b2231;
  --l-muted: #5c6579;
  --l-subtle: #8a93a8;
  --l-line: rgba(24, 36, 68, 0.10);
  --l-line-strong: rgba(24, 36, 68, 0.18);
  --accent-ink: #2b7bff;
}

* { box-sizing: border-box; }
html { background: #e6eaf3; scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--l-ink);
  background:
    radial-gradient(circle at 82% 8%, rgba(100, 168, 255, 0.16), transparent 32rem),
    radial-gradient(circle at 8% 92%, rgba(150, 109, 255, 0.10), transparent 32rem),
    linear-gradient(180deg, #eef1f8, #e6eaf3);
  font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

#motionCanvas { display: none; }

.shell {
  width: min(1280px, calc(100% - 32px));
  min-height: calc(100vh - 16px);
  margin: 0 auto 16px;
  border: 1px solid var(--l-line-strong);
  border-top: 0;
  border-radius: 0 0 22px 22px;
  background: linear-gradient(180deg, #f9fbff, #eef1f8);
  box-shadow: 0 34px 90px rgba(30, 44, 90, 0.14), inset 0 1px rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 76px;
  padding: 0 20px;
  border-bottom: 1px solid var(--l-line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "DM Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.13em;
}
.brand span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(77, 226, 208, 0.55);
  border-radius: 50%;
  background: conic-gradient(from 90deg, rgba(77,226,208,.4), rgba(100,168,255,.25), rgba(150,109,255,.44), rgba(77,226,208,.4));
  box-shadow: 0 0 24px rgba(77,226,208,.18);
  letter-spacing: 0;
}

.nav {
  display: flex;
  justify-content: center;
  gap: 6px;
}
.nav a {
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--l-muted);
  font-size: 0.78rem;
  font-weight: 800;
}
.nav a:hover, .nav a.active {
  border-color: var(--l-line);
  background: rgba(40, 80, 170, 0.08);
  color: var(--l-ink);
}

.search-btn {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--l-line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--l-muted);
  cursor: pointer;
  font-family: "DM Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.search-btn:hover { border-color: var(--blue); color: var(--l-ink); transform: translateY(-1px); }

.page {
  padding: clamp(24px, 5vw, 56px);
  animation: enter .28s ease both;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin: 8px 0 28px;
}
.kicker, .tag, .project-card small, .post-card small, .link-panel span {
  font-family: "DM Mono", monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.kicker {
  margin: 0 0 9px;
  color: var(--accent-ink);
  font-size: 0.62rem;
}
.hero h1 {
  max-width: 820px;
  margin: 0 0 12px;
  color: var(--l-ink);
  font-size: clamp(1.75rem, 3.2vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
}
.hero p {
  max-width: 680px;
  margin: 0;
  color: var(--l-muted);
  font-size: 1rem;
  line-height: 1.7;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: linear-gradient(90deg, #2b7bff, #6a5cff);
  color: #fff;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 10px 22px rgba(43, 90, 220, 0.24);
}
.button:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(43, 90, 220, 0.32); }

.hero-actions {
  display: grid;
  justify-items: end;
  gap: 12px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(77, 226, 208, 0.4);
  border-radius: 999px;
  background: rgba(77, 226, 208, 0.08);
  color: var(--green);
  font-family: "DM Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(77, 226, 208, 0.5);
  animation: pulse-dot 2.2s ease-out infinite;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.stat-strip div, .section-block, .focus-card, .jump-card, .idea-card, .about-grid article, .link-panel, .contact-form {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: inset 0 1px rgba(255,255,255,.04);
}
/* Section wrappers are light chrome; the cards inside them stay dark. */
.section-block {
  border-color: var(--l-line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.6);
}
/* Light text inside dark cards where the color would otherwise be inherited from the (now dark-ink) page. */
.discipline-card strong,
.art-card strong,
.album-card strong,
.link-panel a strong,
.approach-item strong { color: #eef1ff; }
.stat-strip div { min-height: 104px; padding: 16px; }
.stat-strip span {
  color: var(--subtle);
  font-family: "DM Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.stat-strip strong {
  display: block;
  margin-top: 14px;
  font-size: 1.22rem;
}

.home-stage, .contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 12px;
  margin-bottom: 12px;
}

.writing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
}
.focus-card, .jump-card, .section-block, .idea-card, .about-grid article, .link-panel, .contact-form {
  padding: 18px;
}
.focus-card h2 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(1.5rem, 3.3vw, 2.7rem);
  line-height: 1.08;
}
.signal-map {
  position: relative;
  min-height: clamp(28rem, 50vw, 34rem);
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(rgba(139,154,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139,154,255,.07) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(100,168,255,.12), transparent 17rem),
    rgba(5,7,20,.32);
  background-size: 32px 32px, 32px 32px, auto, auto;
}
.signal-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(64%, 25rem);
  aspect-ratio: 1;
  border: 1px dashed rgba(77,226,208,.32);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.signal-orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(64%, 25rem);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  animation: orbit-spin 34s linear infinite;
}
.signal-photo {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: grid;
  width: clamp(6.5rem, 18vw, 9.5rem);
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(77,226,208,.55);
  border-radius: 50%;
  background:
    radial-gradient(circle at 28% 18%, rgba(77,226,208,.24), transparent 4rem),
    linear-gradient(135deg, rgba(100,168,255,.16), rgba(150,109,255,.2)),
    rgba(13,15,44,.96);
  box-shadow: 0 0 46px rgba(77,226,208,.18), inset 0 1px rgba(255,255,255,.06);
  transform: translate(-50%, -50%);
}
.signal-photo span {
  color: var(--text);
  font-family: "DM Mono", monospace;
  font-size: clamp(1.3rem, 4vw, 2.2rem);
}
.signal-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.signal-node {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: clamp(5.4rem, 16vw, 7.3rem);
  aspect-ratio: 1;
  padding: 0 12px;
  border: 1px solid rgba(100,168,255,.45);
  border-radius: 50%;
  background: rgba(13,15,44,.9);
  font-family: "DM Mono", monospace;
  box-shadow: 0 0 30px rgba(100,168,255,.12);
  text-align: center;
  transform: translate(-50%, -50%) rotate(var(--angle)) translateX(clamp(8rem, 17vw, 11rem)) rotate(calc(-1 * var(--angle)));
}
.signal-node span {
  display: block;
  animation: orbit-counter 34s linear infinite;
}
.signal-node:hover {
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 36px rgba(77,226,208,.18);
}

.jump-card {
  display: grid;
  align-content: start;
  gap: 9px;
}
.jump-card a, .link-panel a {
  display: grid;
  gap: 8px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5,7,22,.36);
}
.jump-card a {
  grid-template-columns: 1fr auto;
  align-items: end;
  font-weight: 900;
}
.jump-card a:hover, .link-panel a:hover { border-color: rgba(77,226,208,.45); background: rgba(77,226,208,.07); }

.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.section-head h2 {
  margin: 0;
  color: var(--l-ink);
  font-size: 1.1rem;
}
.section-head a, .project-card footer a {
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 900;
}

.project-grid, .post-grid, .art-grid, .about-grid, .research-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.project-grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.project-card {
  position: relative;
  display: grid;
  grid-template-columns: 0.74fr 1fr;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
/* The filter sets [hidden] to hide non-matching cards; the display:grid above
   would otherwise override it, so re-assert none. */
.project-card[hidden] { display: none; }

/* Clickable blog post cards + the article reader in the popup */
.post-card[data-post] { cursor: pointer; }
.post-card .post-read { display: inline-flex; align-items: center; margin-left: 14px; color: var(--green); font-weight: 700; font-size: 0.9rem; }
.modal-article time { display: block; margin: 2px 0 16px; color: var(--muted); font-size: 0.9rem; }
.modal-article .article-body p { margin: 0 0 1.05em; line-height: 1.75; }
.modal-article .article-body p:last-child { margin-bottom: 0; }

/* First-line paragraph indents for long-form prose (blog articles + About
   story). Change or remove the text-indent value to adjust the indent size. */
.modal-article .article-body p, .story-card p { text-indent: 1.6em; }
.project-card::before, .art-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent, var(--blue)) 30%, transparent), transparent 16rem);
  transition: opacity .18s ease;
}
.project-card:hover::before, .art-card:hover::before { opacity: 1; }
.project-art, .project-copy, .art-card > * { position: relative; z-index: 1; }
.project-art {
  min-height: 100%;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at 35% 30%, var(--accent), transparent 8rem),
    linear-gradient(135deg, rgba(255,255,255,.045), rgba(5,7,22,.2)),
    #070817;
}
.project-art span {
  position: absolute;
  inset: 18%;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
}
.project-art i {
  position: absolute;
  width: 42%;
  aspect-ratio: 1;
  right: 15%;
  bottom: 16%;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 34%, transparent);
  box-shadow: 0 0 34px var(--accent);
}
.project-copy {
  padding: 16px;
}
.project-card small, .post-card small, .link-panel span {
  color: var(--subtle);
  font-size: 0.56rem;
}
.project-card h2, .post-card h2, .idea-card h2 {
  margin: 16px 0 0;
  color: #e8ebff;
  font-size: 1.08rem;
  line-height: 1.25;
}
.project-card p, .post-card p, .idea-card p, .about-grid p, .modal-card p, .modal-card dd {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.62;
}
.tag {
  display: inline-flex;
  margin: 5px 5px 0 0;
  padding: 4px 7px;
  border: 1px solid rgba(153,174,255,.19);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.5rem;
}
.project-card footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}
.project-card footer button {
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-weight: 900;
  padding: 0;
}

.research-card {
  position: relative;
  min-height: 250px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  border-radius: 16px;
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 13rem),
    var(--panel);
}
.research-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 26%, transparent), transparent 15rem);
  transition: opacity .18s ease;
}
.research-card:hover::before { opacity: 1; }
.research-card > * { position: relative; z-index: 1; }
.research-card small {
  color: var(--subtle);
  font-family: "DM Mono", monospace;
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.research-card h2 {
  margin: 18px 0 0;
  color: #e8ebff;
  font-size: 1.14rem;
  line-height: 1.25;
}
.research-card p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.62;
}
.research-card footer {
  margin-top: 16px;
  color: var(--green);
  font-family: "DM Mono", monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.filter {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--l-line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--l-muted);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
}
.filter:hover, .filter.active { border-color: var(--accent-ink); color: var(--accent-ink); background: rgba(43, 123, 255, 0.08); }

.art-card {
  position: relative;
  min-height: 430px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
}
.art-card::before { background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--b) 28%, transparent), transparent 17rem); }
.canvas-art {
  position: relative;
  min-height: 285px;
  overflow: hidden;
  background:
    radial-gradient(circle at 24% 24%, var(--a), transparent 12rem),
    radial-gradient(circle at 76% 70%, var(--b), transparent 14rem),
    linear-gradient(135deg, rgba(7,8,23,.9), color-mix(in srgb, var(--c) 22%, #070817));
}
.canvas-art.large { min-height: 420px; border-radius: 14px; }
.canvas-art i, .canvas-art b, .canvas-art span {
  position: absolute;
  display: block;
  border: 1px solid rgba(255,255,255,.18);
}
.canvas-art i { inset: 13%; border-radius: 50%; animation: spin 19s linear infinite; }
.canvas-art b { inset: 27% 18%; transform: rotate(-12deg); background: rgba(255,255,255,.04); }
.canvas-art span { width: 34%; aspect-ratio: 1; right: 12%; bottom: 14%; border-radius: 50%; background: color-mix(in srgb, var(--c) 34%, transparent); box-shadow: 0 0 34px var(--c); }
.art-card strong, .art-card p {
  display: block;
  padding: 0 16px;
}
.art-card strong { margin-top: 16px; font-size: 1.08rem; }
.art-card p { color: var(--muted); font-size: 0.75rem; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.album-card {
  position: relative;
  display: block;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
}
.album-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.album-cover {
  position: relative;
  min-height: 210px;
}
.album-cover em {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(5, 7, 20, 0.72);
  color: var(--text);
  font-family: "DM Mono", monospace;
  font-size: 0.56rem;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}
.album-card strong,
.album-card p {
  display: block;
  padding: 0 16px;
}
.album-card strong { margin-top: 16px; font-size: 1.12rem; }
.album-card p { margin: 6px 0 16px; color: var(--muted); font-size: 0.75rem; line-height: 1.5; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 7px 13px;
  border: 1px solid var(--l-line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--l-muted);
  font-family: "DM Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}
.back-link:hover { border-color: var(--blue); color: var(--l-ink); }

.mixer { margin-top: 12px; }
.mixer input { width: 100%; accent-color: var(--green); }
#colorField {
  min-height: 190px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(circle at var(--mix, 46%) 46%, rgba(77,226,208,.72), transparent 9rem),
    radial-gradient(circle at calc(100% - var(--mix, 46%)) 55%, rgba(150,109,255,.68), transparent 10rem),
    #070817;
}

.post-grid {
  grid-template-columns: 1fr;
}
.post-card {
  min-height: 170px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.post-card time {
  color: var(--subtle);
  font-family: "DM Mono", monospace;
  font-size: 0.58rem;
}
.idea-card output {
  display: block;
  min-height: 100px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5,7,22,.36);
  color: var(--green);
  line-height: 1.5;
}

.writing-note {
  min-height: 170px;
  align-self: start;
}

.writing-note .tag {
  margin-top: 8px;
}

.about-grid article ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}
.skill-cloud { margin-top: 10px; }

.disciplines-block { margin-top: 12px; }
.disciplines-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.discipline-card {
  position: relative;
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 22% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 12rem),
    #10152e;
}
.discipline-dot {
  display: block;
  width: 12px;
  height: 12px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}
.discipline-card strong {
  display: block;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}
.discipline-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.62;
}

.story-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.9fr);
  gap: 12px;
  margin-bottom: 12px;
}
.story-card {
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}
.story-card p {
  margin: 0 0 16px;
  color: #dfe4ff;
  font-size: 1.02rem;
  line-height: 1.75;
}
.story-card p:first-child { font-size: 1.14rem; color: var(--text); }
.story-card p:last-child { margin-bottom: 0; }
.story-side {
  display: grid;
  align-content: start;
  gap: 12px;
}
.side-panel {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.side-panel p { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.6; }
.side-panel ul {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.75;
}
.story-side .button { justify-content: center; min-height: 46px; }

.skill-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.skill-group {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #10152e;
}
.skill-group small {
  color: var(--green);
  font-family: "DM Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.skill-group > div { margin-top: 10px; }

.modal-why {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-left: 2px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: rgba(5, 7, 22, 0.4);
}
.modal-why span {
  display: block;
  margin-bottom: 6px;
  color: var(--subtle);
  font-family: "DM Mono", monospace;
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.approach-block { margin-top: 12px; }
.approach-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.approach-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--green);
  border-radius: 14px;
  background: #10152e;
}
.approach-item strong {
  display: block;
  font-size: 0.98rem;
}
.approach-item p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.62;
}

.link-panel {
  display: grid;
  gap: 8px;
}
.link-panel a strong { display: block; font-size: 0.95rem; }
.contact-form {
  display: grid;
  gap: 13px;
  align-content: start;
}
.contact-form label, .search-head label {
  display: grid;
  gap: 7px;
  color: var(--subtle);
  font-family: "DM Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5,7,22,.62);
  color: var(--text);
  padding: 11px;
  outline: 0;
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: rgba(100,168,255,.9); box-shadow: 0 0 0 3px rgba(100,168,255,.12); }

dialog {
  width: min(760px, calc(100% - 28px));
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(13,17,42,.98);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
dialog::backdrop { background: rgba(0,0,0,.54); backdrop-filter: blur(8px); }
dialog form {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
dialog form button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  cursor: pointer;
}
.search-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
}
.search-results {
  display: grid;
  gap: 8px;
}
.search-results a {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5,7,22,.38);
}
.search-results a:hover { border-color: rgba(100,168,255,.55); }
.search-results span, .modal-card dt {
  color: var(--subtle);
  font-family: "DM Mono", monospace;
  font-size: 0.56rem;
  text-transform: uppercase;
}
.search-results p { margin: 0; color: var(--muted); font-size: 0.7rem; line-height: 1.45; }
.modal-card h2 { margin: 8px 0 0; font-size: clamp(1.6rem, 5vw, 3.4rem); line-height: 1; }
.modal-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.modal-card dd { margin: 4px 0 0; }
.modal-card .button { margin-top: 16px; }

.sitefoot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 22px clamp(24px, 5vw, 56px);
  border-top: 1px solid var(--l-line);
  background: rgba(255, 255, 255, 0.72);
}
.sitefoot-brand { display: grid; gap: 4px; }
.sitefoot-brand strong { font-size: 0.92rem; color: var(--l-ink); }
.sitefoot-brand span {
  color: var(--l-subtle);
  font-family: "DM Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
}
.sitefoot-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
}
.sitefoot-nav a {
  color: var(--l-muted);
  font-size: 0.74rem;
  font-weight: 700;
}
.sitefoot-nav a:hover { color: var(--accent-ink); }
.sitefoot-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}
.sitefoot-meta a { color: var(--accent-ink); font-size: 0.74rem; font-weight: 700; }
.sitefoot-meta a:hover { color: var(--l-ink); }
.sitefoot-meta small {
  color: var(--l-subtle);
  font-family: "DM Mono", monospace;
  font-size: 0.56rem;
  letter-spacing: 0.05em;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(77, 226, 208, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(77, 226, 208, 0); }
  100% { box-shadow: 0 0 0 0 rgba(77, 226, 208, 0); }
}
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes orbit-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes orbit-counter { to { transform: rotate(-360deg); } }

/* ---------- Light, photo-centric home hero ---------- */
/* Morgan-style stage: figure centred, text left, cards scattered around */
.intro-hero {
  position: relative;
  min-height: min(72vh, 660px);
  margin-bottom: 28px;
}
.intro-copy {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: min(40%, 30rem);
  display: grid;
  gap: 14px;
  z-index: 3;
}
.intro-roles {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.role-card {
  position: absolute;
  width: clamp(10rem, 13vw, 12.5rem);
  pointer-events: auto;
}
/* Code (1) and Art (3) share the same x; Design (2) juts out to the right.
   Even vertical spacing between all three. */
.role-card:nth-child(1) { top: 6%; right: 7%; }
.role-card:nth-child(2) { top: 39%; right: 0; }
.role-card:nth-child(3) { top: 72%; right: 7%; }
.role-thumb {
  position: relative;
  height: 8.8rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: #0c1226;
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.42);
}
.role-svg { display: block; width: 100%; height: 100%; }
.role-pill {
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 999px;
  background: #fff;
  color: #1b2231;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.32);
}
.hello {
  margin: 0;
  color: var(--l-muted);
  font-family: "DM Mono", monospace;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}
.intro-name {
  margin: 0;
  color: var(--l-ink);
  font-family: "Dancing Script", "Manrope", cursive;
  font-weight: 700;
  font-size: clamp(4.4rem, 12vw, 9rem);
  line-height: 1.04;
  letter-spacing: 0;
  /* Signature-script reveal: wipe in from the left, like a pen stroke. */
  clip-path: inset(-8% 100% -14% -6%);
  animation: handwrite 1.6s cubic-bezier(0.6, 0.02, 0.24, 1) 0.25s forwards;
}
@keyframes handwrite {
  to { clip-path: inset(-8% -8% -14% -6%); }
}
.intro-bio {
  margin: 6px 0 0;
  max-width: 40ch;
  color: var(--l-muted);
  font-size: 1.04rem;
  line-height: 1.72;
}
body[data-page="home"] .status-pill {
  width: max-content;
  border-color: rgba(15, 143, 125, 0.34);
  background: rgba(77, 226, 208, 0.16);
  color: #0d8f7d;
}
.intro-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.email-pill {
  padding: 11px 18px;
  border: 1px solid var(--l-line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--l-ink);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(30, 44, 90, 0.08);
}
.email-pill:hover { border-color: var(--blue); transform: translateY(-1px); }
.socials { display: flex; gap: 10px; }
.social {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--l-line-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--l-ink);
  box-shadow: 0 8px 18px rgba(30, 44, 90, 0.08);
}
.social svg { width: 19px; height: 19px; }
.social:hover { background: var(--blue); border-color: var(--blue); color: #fff; transform: translateY(-2px); }

.intro-portrait {
  position: absolute;
  left: 53%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 2;
  display: grid;
  place-items: end center;
}
.portrait-glow {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(132%, 42rem);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(100, 168, 255, 0.26), rgba(150, 109, 255, 0.13) 52%, transparent 70%);
  filter: blur(10px);
  z-index: -1;
}
/* Frameless floating cutout (Morgan-style) */
.portrait-frame {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: end center;
  width: 100%;
}
/* Slide the portrait up from the bottom. JS adds .portrait-pending immediately
   (hiding it), then .portrait-in the moment the image is ready to paint, so the
   slide starts right on load with no fixed delay and is always visible. It lives
   on the frame (not .intro-portrait, which is transform-centered) so nothing shifts. */
.portrait-frame.portrait-pending { opacity: 0; }
.portrait-frame.portrait-pending.portrait-in { animation: portraitRise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
@keyframes portraitRise {
  from { opacity: 0; transform: translateY(72px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Code/Design/Art cards slide in from the left, staggered, after the portrait
   rises. JS adds .slide-left up front, then .in to start it, then removes both
   when done so the hover lift stays snappy. */
.role-card.slide-left { opacity: 0; }
.role-card.slide-left.in { animation: cardSlideLeft 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes cardSlideLeft {
  from { opacity: 0; transform: translateX(-54px); }
  to { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .role-card.slide-left, .role-card.slide-left.in { opacity: 1 !important; animation: none !important; }
}
.portrait-frame img {
  height: clamp(19rem, 35vw, 33rem);
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 26px 40px rgba(0, 0, 0, 0.5));
  -webkit-mask-image: linear-gradient(to bottom, #000 88%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 88%, transparent 100%);
}
.portrait-frame .portrait-initials { padding: 3rem 0; }
.portrait-initials {
  font-family: "DM Mono", monospace;
  font-size: clamp(3.4rem, 11vw, 6.4rem);
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.float-card {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid var(--l-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 34px rgba(40, 60, 120, 0.16);
  color: var(--l-ink);
  font-size: 0.82rem;
  font-weight: 800;
  backdrop-filter: blur(6px);
  animation: floaty 6s ease-in-out infinite;
}
.float-card i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.fc-1 { top: 6%; right: 0; animation-delay: 0s; }
.fc-2 { top: 44%; right: -5%; animation-delay: 1.2s; }
.fc-3 { bottom: 8%; left: 0; animation-delay: 2.4s; }

@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

@media (max-width: 1050px) {
  .topbar { grid-template-columns: 1fr auto; }
  .nav { grid-column: 1 / -1; justify-content: flex-start; overflow-x: auto; padding-bottom: 10px; }
  .hero, .home-stage, .writing-layout, .contact-grid, .story-layout { grid-template-columns: 1fr; }
  /* Undo the absolute Morgan stage — stack cleanly on tablet/phone */
  .intro-hero { position: static; min-height: auto; display: grid; grid-template-columns: 1fr; gap: 8px; }
  .intro-copy { position: static; transform: none; width: auto; }
  .intro-portrait { position: static; transform: none; min-height: 26rem; margin-top: 8px; }
  .intro-roles { position: static; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 14px; margin-bottom: 26px; pointer-events: auto; }
  .role-card { position: relative; width: auto; }
  .role-card:nth-child(1), .role-card:nth-child(2), .role-card:nth-child(3) { inset: auto; }
  .role-thumb { height: 7rem; }
  .stat-strip, .project-grid, .project-grid.wide, .art-grid, .album-grid, .about-grid, .research-grid, .approach-grid, .disciplines-grid, .skill-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-actions { justify-items: start; }
  .sitefoot { grid-template-columns: 1fr; justify-items: start; gap: 14px; text-align: left; }
  .sitefoot-nav { justify-content: flex-start; }
  .sitefoot-meta { justify-items: start; text-align: left; }
}

@media (max-width: 700px) {
  .shell { width: 100%; min-height: 100vh; margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .topbar { padding: 10px 12px; }
  .brand b { display: none; }
  .page { padding: 20px 12px; }
  .hero h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); overflow-wrap: anywhere; }
  .stat-strip, .project-grid, .project-grid.wide, .art-grid, .album-grid, .about-grid, .research-grid, .approach-grid, .disciplines-grid, .skill-groups { grid-template-columns: 1fr; }
  .project-card { grid-template-columns: 1fr; }
  .project-art { min-height: 180px; border-right: 0; border-bottom: 1px solid var(--line); }
  .intro-name { font-size: clamp(4rem, 22vw, 6.2rem); }
  .portrait-frame img { height: clamp(20rem, 78vw, 28rem); }
  .fc-1 { top: 2%; right: 0; }
  .fc-2 { top: 46%; right: 0; }
  .fc-3 { bottom: 4%; left: 0; }
  .signal-map { min-height: 300px; }
  .signal-orbit,
  .signal-ring { width: min(70%, 19rem); }
  .signal-node {
    width: 4.8rem;
    font-size: 0.68rem;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateX(clamp(5.8rem, 24vw, 7.2rem)) rotate(calc(-1 * var(--angle)));
  }
  .modal-card dl { grid-template-columns: 1fr; }
}

/* ============================================================
   Inverted theme — dark page/chrome + light (white) cards.
   ("Switch the light and dark parts.")
   Appended last so it overrides the light-base rules above.
   ============================================================ */

/* --- Chrome goes dark --- */
html { background: var(--black); }
body {
  color: var(--text);
  background:
    radial-gradient(circle at 12% 6%, rgba(77, 226, 208, 0.14), transparent 28rem),
    radial-gradient(circle at 86% 14%, rgba(150, 109, 255, 0.2), transparent 34rem),
    radial-gradient(circle at 52% 100%, rgba(100, 168, 255, 0.12), transparent 30rem),
    var(--black);
}
#motionCanvas { display: block; position: fixed; inset: 0; z-index: -2; width: 100%; height: 100%; opacity: 0.55; }
.shell {
  border-color: var(--line-strong);
  background: linear-gradient(135deg, rgba(255,255,255,0.045), transparent 34%), rgba(6, 8, 24, 0.82);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,0.05);
  backdrop-filter: blur(22px);
}
.topbar { background: rgba(7, 9, 27, 0.88); border-bottom-color: var(--line); }
.brand, .brand b { color: var(--text); }
.nav a { color: var(--muted); }
.nav a:hover, .nav a.active { border-color: var(--line); background: rgba(100,168,255,.1); color: var(--text); }
.search-btn { background: rgba(255,255,255,.035); border-color: var(--line-strong); color: var(--muted); }
.search-btn:hover { border-color: var(--blue); color: var(--text); }
.kicker { color: var(--green); }
.hero h1 { color: var(--text); }
.hero p { color: var(--muted); }
.section-head h2 { color: var(--text); }
.filter { background: rgba(37,42,84,.3); border-color: var(--line); color: var(--muted); }
.filter:hover, .filter.active { border-color: rgba(77,226,208,.42); color: var(--green); background: rgba(77,226,208,.08); }
.back-link { background: rgba(255,255,255,.035); border-color: var(--line); color: var(--muted); }
.back-link:hover { border-color: var(--blue); color: var(--text); }
.section-block { background: rgba(255,255,255,.03); border-color: var(--line); box-shadow: none; }
.sitefoot { background: rgba(5, 7, 20, 0.5); border-top-color: var(--line); }
.sitefoot-brand strong { color: var(--text); }
.sitefoot-brand span, .sitefoot-meta small { color: var(--subtle); }
.sitefoot-nav a { color: var(--muted); }
.sitefoot-nav a:hover { color: var(--green); }
.sitefoot-meta a { color: var(--blue); }

/* Home hero text back to light on the dark page */
.intro-name { color: var(--text); }
.hello, .intro-bio { color: var(--muted); }
.intro-copy .status-pill { border-color: rgba(77,226,208,.4); background: rgba(77,226,208,.08); color: var(--green); }

/* --- Cards go light (white, dark text) --- */
.project-card, .art-card, .album-card, .skill-group, .approach-item,
.story-card, .side-panel, .post-card, .about-grid article, .contact-form, .idea-card {
  background: #ffffff;
  border-color: rgba(24, 36, 68, 0.10);
  box-shadow: 0 12px 30px rgba(20, 32, 66, 0.06);
}
.discipline-card { background: radial-gradient(circle at 22% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 12rem), #ffffff; border-color: rgba(24,36,68,0.10); }
.research-card { background: radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 13rem), #ffffff; border-color: rgba(24,36,68,0.10); }

/* Card text -> dark */
.project-card h2, .post-card h2, .idea-card h2, .research-card h2,
.discipline-card strong, .art-card strong, .album-card strong,
.link-panel a strong, .approach-item strong, .story-card p:first-child { color: #1b2231; }
.project-card p, .post-card p, .idea-card p, .about-grid p, .research-card p,
.discipline-card p, .approach-item p, .art-card p, .album-card p,
.about-grid article ul, .story-card p, .side-panel p, .side-panel ul { color: #5c6579; }
.project-card small, .post-card small, .post-card time, .research-card small,
.album-card p, .contact-form label, .link-panel span { color: #8a93a8; }
.tag { color: #5c6579; border-color: rgba(24, 36, 68, 0.16); }
.skill-group small, .research-card footer, .project-card footer button { color: #0d8f7d; }
.project-card footer a, .section-head a { color: #2b7bff; }
.project-art { border-right-color: rgba(24, 36, 68, 0.10); }

/* Light chips / inputs inside the now-light cards */
.link-panel a, .jump-card a { background: #f3f6fc; border-color: rgba(24,36,68,0.10); }
.link-panel a:hover, .jump-card a:hover { border-color: rgba(43,123,255,.4); background: #eaf1ff; }
.contact-form input, .contact-form textarea { background: #f3f6fc; border-color: rgba(24,36,68,0.12); color: #1b2231; }

/* Keep the modal/search overlays dark, so their tags stay light */
dialog .tag { color: var(--muted); border-color: rgba(153,174,255,.19); }
/* Kicker labels sitting inside the now-light cards need a dark accent. */
.side-panel .kicker, .idea-card .kicker { color: #0d8f7d; }

/* ============================================================
   Motion — scroll reveals, hover lifts, modal entrance
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .65s cubic-bezier(.2, .7, .2, 1), transform .65s cubic-bezier(.2, .7, .2, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }

/* Cards lift on hover */
.project-card, .research-card, .art-card, .album-card, .discipline-card, .post-card, .role-card {
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}
.project-card:hover, .research-card:hover, .art-card:hover, .discipline-card:hover, .post-card:hover { transform: translateY(-4px); }
.role-card:hover { transform: translateY(-6px); }
.role-card { transition: transform .3s cubic-bezier(.2, .7, .2, 1); }

/* Social / email / search chips */
.email-pill, .social, .search-btn, .button, .jump-card a, .link-panel a { transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease, color .2s ease; }

/* Modal / search dialog entrance */
dialog[open] { animation: dialogPop .3s cubic-bezier(.2, .8, .2, 1); }
dialog[open]::backdrop { animation: fadeIn .3s ease; }
@keyframes dialogPop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  dialog[open], dialog[open]::backdrop { animation: none !important; }
}

/* ---------- Images & iframe embeds in projects and art ---------- */
.project-art.has-media { padding: 0; background: #0c1226; }
.project-art.has-media img { width: 100%; height: 100%; object-fit: cover; }
.canvas-art.has-media { background: #0c1226; }
.canvas-art.has-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.canvas-art.album-cover.has-media em { z-index: 2; }
.modal-media img { display: block; width: 100%; border-radius: 12px; margin-bottom: 4px; }

/* Logo mode: when a project/piece sets imageBg, the image is a logo, show it
   contained and centered on that background color instead of cropped to fill. */
.project-art.has-media.is-logo,
.canvas-art.has-media.is-logo { background: var(--img-bg); display: grid; place-items: center; }
.project-art.has-media.is-logo img,
.canvas-art.has-media.is-logo img {
  position: static;
  inset: auto;
  width: auto;
  height: auto;
  max-width: var(--logo-max, 88%);
  max-height: var(--logo-max, 88%);
  object-fit: contain;
}
.modal-media.is-logo { background: var(--img-bg); border-radius: 12px; display: grid; place-items: center; padding: 24px; margin-bottom: 4px; }
.modal-media.is-logo img { width: auto; max-width: 60%; max-height: 220px; margin: 0; border-radius: 0; }

/* Fallback when an image fails to load (wrong filename, not uploaded yet):
   show a soft colored panel instead of the browser's broken-image icon. */
.project-art.has-media.img-failed { background: linear-gradient(135deg, var(--accent, #4de2d0), #0c1226); }
.canvas-art.has-media.img-failed { background: linear-gradient(135deg, var(--a, #4de2d0), var(--c, #966dff)); }
.modal-media.img-failed { min-height: 140px; border-radius: 12px; margin-bottom: 4px; background: linear-gradient(135deg, var(--accent, #4de2d0), #0c1226); }

/* Multi-image gallery in the Details popup (art pieces with several images) */
.modal-gallery { display: grid; gap: 10px; margin-bottom: 4px; }
.modal-gallery .gal-item { border-radius: 12px; overflow: hidden; }
.modal-gallery .gal-item img { display: block; width: 100%; }
.modal-gallery .gal-item.img-failed { min-height: 160px; background: linear-gradient(135deg, var(--a, #4de2d0), var(--c, #966dff)); }

/* Give art-card image panels a fixed height so every preview is the same size
   (tall/portrait images no longer stretch their card). Cover images fill it;
   logo-mode images are centered and contained within it. */
.canvas-art.has-media { height: 300px; }
.album-card .canvas-art.album-cover.has-media { height: 260px; }

/* Subtle hover-zoom on card images */
.project-art.has-media, .canvas-art.has-media { overflow: hidden; }
.project-art.has-media img, .canvas-art.has-media img { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.project-card:hover .project-art.has-media img,
.art-card:hover .canvas-art.has-media img,
.album-card:hover .canvas-art.has-media img { transform: scale(1.05); }

/* Click-to-preview lightbox with zoom & pan */
.zoomable { cursor: zoom-in; }
.lightbox { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; background: transparent; overflow: hidden; }
.lightbox::backdrop { background: rgba(3, 5, 12, 0.92); backdrop-filter: blur(4px); }
.lightbox .lb-stage { position: fixed; inset: 0; display: grid; place-items: center; padding: 4vmin; }
.lightbox .lb-img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 8px; transform-origin: center; touch-action: none; user-select: none; -webkit-user-drag: none; }
.lightbox .lb-close { position: fixed; top: 16px; right: 16px; }
.lightbox .lb-controls { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.lb-btn { display: grid; place-items: center; min-width: 42px; height: 42px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 999px; background: rgba(18, 22, 38, 0.82); color: #fff; font-size: 1.15rem; font-weight: 700; cursor: pointer; backdrop-filter: blur(8px); }
.lb-btn:hover { border-color: rgba(255, 255, 255, 0.55); }
.lb-reset { font-size: 0.85rem; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .project-art.has-media img, .canvas-art.has-media img { transition: none; }
  .project-card:hover .project-art.has-media img,
  .art-card:hover .canvas-art.has-media img,
  .album-card:hover .canvas-art.has-media img { transform: none; }
}
.modal-embed {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0c1226;
}
.modal-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Matrix binary rain (Code role card) */
.matrix .mcol {
  animation-name: matrixfall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform;
}
@keyframes matrixfall {
  from { transform: translateY(-132px); }
  to { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .matrix .mcol { animation: none !important; }
}

/* Design role card motion: selected shape (with its handles) nudges as if
   being dragged, an alignment guide fades in, and a cursor drifts toward it */
.d-select { transform-box: fill-box; transform-origin: center; animation: dnudge 4.6s ease-in-out infinite; }
@keyframes dnudge { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(5px, -4px); } }
.d-guide { opacity: 0; animation: dguide 4.6s ease-in-out infinite; }
@keyframes dguide { 0%, 100% { opacity: 0; } 40%, 70% { opacity: 0.6; } }
.d-cursor { transform-box: fill-box; transform-origin: center; animation: dcursor 4.6s ease-in-out infinite; }
@keyframes dcursor { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-7px, -6px); } }

/* Art role card motion: floating blobs, slowly spinning square */
.a-blob1 { transform-box: fill-box; transform-origin: center; animation: afloat1 7s ease-in-out infinite; }
.a-blob2 { transform-box: fill-box; transform-origin: center; animation: afloat2 8.5s ease-in-out infinite; }
@keyframes afloat1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(4px, -5px) scale(1.06); } }
@keyframes afloat2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-5px, 4px) scale(1.09); } }
.a-square { transform-box: fill-box; transform-origin: center; animation: aspin 22s linear infinite; }
@keyframes aspin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .d-select, .d-guide, .d-cursor, .a-blob1, .a-blob2, .a-square { animation: none !important; }
  .d-guide { opacity: 0.6; }
  .intro-name { animation: none !important; clip-path: none; }
}
