/* Shared public-site styles. Motion follows the same ease and stays out of layout. */
:root {
  color-scheme: dark;
  --bg: #0e0e10;
  --fg: #d8d8de;
  --bright: #f0f0f3;
  --dim: #a3a3ad;
  --faint: #8b8b96;
  --rule: #28282f;
  --edge: #33333c;
  --panel: #18181c;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { scrollbar-gutter: stable; overscroll-behavior-y: none; }
html.contact-open body { position: fixed; inset-inline: 0; top: var(--locked-scroll, 0px); }
body {
  display: flow-root;
  min-height: 100dvh;
  padding: 0 1.5rem;
  background: var(--bg);
  color: var(--fg);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-transform: lowercase;
  -webkit-font-smoothing: antialiased;
}
code, pre, kbd, samp { text-transform: none; }
button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; text-transform: lowercase; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
main { width: min(38rem, 100%); margin: clamp(4rem, 12vh, 8rem) auto 3rem; }
.home { margin-block: clamp(3rem, 8vh, 6rem) 2rem; transform-origin: center 40%; transition: transform 480ms var(--ease), opacity 320ms ease; }
.home[inert] { transform: translateY(-2px) scale(0.99); opacity: 0.7; }
.reading { animation: settle 800ms var(--ease) both; }
.head h1 { animation: name-in 950ms var(--ease) both; }
.head p, .avail, .home > section, .home > footer { animation: settle 850ms var(--ease) both; }
.head p { animation-delay: 80ms; }
.avail { animation-delay: 140ms; }
.home > section { animation-delay: 220ms; }
.home > section:nth-of-type(2) { animation-delay: 280ms; }
.home > section:nth-of-type(3) { animation-delay: 340ms; }
.home > section:nth-of-type(n+4) { animation-delay: 400ms; }
.home > footer { animation-delay: 420ms; }
@keyframes name-in {
  from { opacity: 0; transform: translateY(12px); clip-path: inset(0 0 25%); }
  to { opacity: 1; transform: none; clip-path: inset(0); }
}
@keyframes settle { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.head { margin-bottom: 2.5rem; }
.head .id { display: flex; align-items: center; gap: 1.15rem; }
.avatar {
  flex: none;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--rule);
  animation: avatar-in 950ms var(--ease) both;
  animation-delay: 50ms;
}
@keyframes avatar-in { from { opacity: 0; transform: scale(0.82); } to { opacity: 1; transform: none; } }
.head h1 {
  color: var(--bright);
  font-size: clamp(2.5rem, 5vw, 3rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.055em;
}
.head p { max-width: 29rem; margin-top: 1.1rem; color: var(--dim); font-size: 1.15rem; line-height: 1.65; text-wrap: pretty; }
.head .role { color: var(--fg); font-size: 1.0625rem; }
.head .bio { margin-top: 0.25rem; font-size: 0.9375rem; }
.avail { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; margin-top: 1.25rem; font-size: 0.875rem; color: var(--dim); }

.home > section { display: grid; grid-template-columns: 6.75rem minmax(0, 1fr); align-items: baseline; gap: 1.5rem; padding-block: 1.5rem; border-top: 1px solid var(--rule); }
h2 { color: var(--faint); font-size: 0.875rem; line-height: 1.65; font-weight: 400; }
ul { list-style: none; }
a, a:visited, .contact-btn, .text-btn {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: #55555f;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: color 180ms ease, text-decoration-color 220ms ease;
}
a:hover, .contact-btn:hover, .text-btn:hover { color: var(--bright); text-decoration-color: var(--bright); }
.project-link, .social-links a, .contact-btn { position: relative; text-decoration: none; }
.project-link { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.project-link::before, .social-links a::before, .contact-btn::before,
.project-link::after, .social-links a::after, .contact-btn::after {
  content: "";
  position: absolute;
  top: calc(50% + 0.7em);
  inset-inline: 0;
  height: 1px;
  background: #55555f;
  pointer-events: none;
}
.project-link::after, .social-links a::after, .contact-btn::after {
  background: var(--bright);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 480ms var(--ease);
}
:is(.project-link, .social-links a, .contact-btn):is(:hover, :focus-visible)::after { transform: scaleX(1); transform-origin: left; }
.home > .projects { position: relative; display: block; padding-block: 1.5rem 2rem; }
.projects::before { content: ""; position: absolute; top: -1px; left: 0; width: 2.5rem; height: 1px; background: var(--dim); transform-origin: left; animation: project-rule-in 1000ms var(--ease) 220ms both; }
@keyframes project-rule-in { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: scaleX(1); } }
.projects h2 { margin-bottom: 1.25rem; color: var(--bright); font-size: 1.25rem; font-weight: 500; letter-spacing: -0.025em; line-height: 1.4; }
.project-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 2rem; min-width: 0; }
.proj { min-width: 0; }
.proj:nth-child(n+3) { padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.project-title { font-size: 1.1875rem; font-weight: 500; line-height: 1.45; letter-spacing: -0.025em; }
.d { display: block; margin-top: 0.625rem; color: var(--dim); font-size: 0.9375rem; line-height: 1.7; text-wrap: pretty; }
.social-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.social-links a { display: inline-flex; align-items: center; min-height: 2rem; }
.writing-list { display: grid; gap: 1.25rem; }
.writing-list a { overflow-wrap: anywhere; }

.home > .now-playing { align-items: start; }
.home.music-pending > .now-playing[hidden] { display: grid !important; min-height: 5.3rem; visibility: hidden; }
.now-playing h2 { padding-top: 0.1rem; }
.now-body { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 1rem; }
.now-art { display: block; width: 4.25rem; height: 4.25rem; object-fit: cover; background: var(--panel); border-radius: 5px; transition: transform 600ms var(--ease); }
.now-art[hidden] + .now-copy { grid-column: 1 / -1; }
.now-copy { min-width: 0; }
.now-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0 0.75rem; }
.now-title { color: var(--bright); font-size: 0.9375rem; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.now-links { display: flex; align-items: center; gap: 0.25rem; }
.now-links a { display: inline-flex; width: 1.75rem; height: 1.75rem; align-items: center; justify-content: center; color: var(--faint); text-decoration: none; border-radius: 4px; transition: color 240ms ease, transform 420ms var(--ease), background-color 240ms ease; }
.now-links a:hover { color: var(--bright); }
.now-links svg { width: 1rem; height: 1rem; fill: currentColor; }
.now-artist { color: var(--dim); font-size: 0.8125rem; line-height: 1.5; overflow-wrap: anywhere; }
.now-player { display: flex; align-items: center; gap: 0.625rem; margin-top: 0.35rem; }
.now-toggle { display: inline-flex; flex: none; align-items: center; gap: 0.35rem; width: 3.75rem; min-height: 2rem; color: var(--fg); font-size: 0.8125rem; text-align: left; transition: color 240ms ease, transform 350ms var(--ease); }
.now-toggle:hover { color: var(--bright); }
.now-toggle:active { transform: scale(0.95); }
.now-toggle svg { flex: none; width: 0.875rem; height: 0.875rem; fill: currentColor; overflow: visible; }
.play-mark, .pause-mark { transform-origin: center; transition: transform 380ms var(--ease), opacity 220ms ease; }
.pause-mark { opacity: 0; transform: scale(0.65) rotate(-15deg); }
.is-playing .play-mark { opacity: 0; transform: scale(0.65) rotate(15deg); }
.is-playing .pause-mark { opacity: 1; transform: none; }
.now-toggle:disabled { color: var(--faint); cursor: default; }
.now-time { flex: none; color: var(--faint); font-size: 0.6875rem; font-variant-numeric: tabular-nums; }
.now-track { position: relative; flex: 1; height: 2rem; min-width: 2rem; cursor: pointer; touch-action: none; }
.now-track::before { content: ""; position: absolute; inset: calc(50% - 1px) 0 auto; height: 2px; border-radius: 2px; background: var(--edge); }
.now-progress { position: absolute; top: calc(50% - 1px); left: 0; width: 100%; height: 2px; background: var(--fg); border-radius: 2px; transform: scaleX(0); transform-origin: left; }
.now-track::after { content: ""; position: absolute; top: 50%; left: var(--seek-position, 0%); width: 6px; height: 6px; border-radius: 50%; background: var(--bright); opacity: 0; transform: translate(-50%, -50%) scale(0.5); transition: opacity 180ms ease, transform 320ms var(--ease); pointer-events: none; }
.now-track:is(:hover, :focus-visible, .seeking)::after { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.player-status { grid-column: 1 / -1; color: var(--dim); font-size: 0.8125rem; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.7);
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  transition: opacity 260ms ease, visibility 0s linear 380ms;
}
.modal.on { opacity: 1; visibility: visible; transition: opacity 360ms ease; }
.modal-card {
  position: relative;
  width: min(25rem, 100%);
  max-height: calc(100dvh - 2.5rem);
  overflow-y: auto;
  padding: 1.75rem;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  overscroll-behavior: contain;
  transform: translateY(12px) scale(0.975);
  transition: transform 440ms var(--ease);
}
.modal.on .modal-card { transform: none; }
.modal-card h2 { margin-bottom: 1.1rem; color: var(--bright); font-size: 1.25rem; font-weight: 500; letter-spacing: -0.02em; }
.modal-card h2, .modal-card .m-row { opacity: 0; transform: translateY(4px); transition: opacity 200ms ease, transform 400ms var(--ease); }
.modal.on .modal-card h2, .modal.on .m-row { opacity: 1; transform: none; }
.modal.on .modal-card h2 { transition-delay: 50ms; }
.modal.on .m-row:nth-of-type(1) { transition-delay: 90ms; }
.modal.on .m-row:nth-of-type(2) { transition-delay: 130ms; }
.m-close { position: absolute; top: 0.6rem; right: 0.6rem; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 6px; color: var(--dim); font-size: 1.5rem; line-height: 1; transition: color 240ms ease, background-color 240ms ease, transform 420ms var(--ease); }
.m-close:hover { color: var(--bright); background: var(--rule); }
.m-close:active { transform: scale(0.9); }
.m-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; font-size: 0.875rem; }
.m-row .k { color: var(--dim); }
.e-wrap { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.e-addr { overflow-wrap: anywhere; }
.copy { position: relative; display: inline-flex; flex: none; width: 2rem; height: 2rem; align-items: center; justify-content: center; color: var(--dim); border-radius: 4px; transition: color 240ms ease, background-color 240ms ease, transform 350ms var(--ease); }
.copy:hover { color: var(--bright); background: var(--rule); }
.copy:active { transform: scale(0.9); }
.copy.ok { color: var(--bright); background: var(--rule); }
.copy .ico { transition: opacity 200ms ease, transform 380ms var(--ease); }
.copy-check { position: absolute; opacity: 0; transform: scale(0.7); }
.copy-check path { stroke-dasharray: 13; stroke-dashoffset: 13; transition: stroke-dashoffset 350ms var(--ease-in-out); }
.copy.ok .ico:not(.copy-check) { opacity: 0; transform: scale(0.7); }
.copy.ok .copy-check { opacity: 1; transform: none; }
.copy.ok .copy-check path { stroke-dashoffset: 0; }
.copy-status { min-height: 1.5em; margin-top: 0.5rem; color: var(--dim); font-size: 0.8125rem; opacity: 0; transform: translateY(3px); transition: opacity 240ms ease, transform 380ms var(--ease); }
.copy-status.is-visible { opacity: 1; transform: none; }
.ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.crumb { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 2.5rem; font-size: 0.9375rem; }
.crumb a { text-decoration: none; }
.slash { color: var(--faint); }
.article-head { margin-bottom: 2rem; }
h1.piece, .archive-title { color: var(--bright); font-size: clamp(1.65rem, 4vw, 2rem); font-weight: 500; line-height: 1.3; letter-spacing: -0.035em; }
p.when { margin-top: 0.75rem; color: var(--dim); font-size: 0.8125rem; }
.archive-title { margin-bottom: 1.5rem; }
p.quiet { max-width: 32rem; color: var(--dim); }

.prose { margin-top: 0; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { max-width: 42rem; margin: 1rem 0; }
.prose h1, .prose h2, .prose h3 { font-weight: 600; letter-spacing: 0; text-transform: none; line-height: 1.35; }
.prose h1, .prose h2 { margin: 2rem 0 0.5rem; color: var(--bright); }
.prose h1 { font-size: 1.1rem; }
.prose h2 { font-size: 1rem; }
.prose h3 { margin: 1.55rem 0 0.4rem; color: var(--fg); font-size: 0.95rem; }
.prose a { white-space: normal; }
.prose ul, .prose ol { margin: 0.9rem 0; padding-left: 1.2rem; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { display: list-item; margin: 0.32rem 0; }
.prose li p { margin: 0.28rem 0; }
.prose blockquote { margin: 1.25rem 0; padding-left: 1rem; border-left: 2px solid #3c3c44; color: var(--dim); }
.prose blockquote p:first-child { margin-top: 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { padding: 0.08em 0.32em; background: #16161a; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.88em; overflow-wrap: normal; }
.prose pre { margin: 1.25rem 0; padding: 0.95rem 1rem; overflow: auto; background: var(--panel); border: 1px solid var(--edge); line-height: 1.6; tab-size: 2; }
.prose pre code { padding: 0; background: none; font-size: inherit; white-space: pre; }
.prose pre[data-lang]::before { display: block; margin-bottom: 0.55rem; color: var(--faint); font-size: 0.75rem; line-height: 1.4; content: attr(data-lang); }
.prose .table-wrap { margin: 1.25rem 0; overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.prose th, .prose td { padding: 0.45rem 0.65rem 0.45rem 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.prose th { color: var(--dim); font-weight: 500; }
.prose figure { margin: 1.45rem 0; }
.prose img, .prose video { display: block; width: 100%; max-width: 100%; height: auto; background: var(--panel); border: 1px solid var(--edge); }
.prose figcaption { margin: 0.45rem 0 0; color: var(--dim); font-size: 0.82rem; line-height: 1.5; }
.prose hr { margin: 1.8rem 0; border: 0; border-top: 1px solid var(--rule); }
.prose dt { margin-top: 0.9rem; color: var(--bright); }
.prose dd { margin-left: 1rem; }
.prose .footnote { margin-top: 1.8rem; color: var(--dim); font-size: 0.85rem; }
.prose .footnote hr { margin-top: 0; }
.prose sup { font-size: 0.75em; line-height: 0; }
.prose sup a, .prose .footnote-backref { padding-bottom: 0; color: var(--dim); border-bottom: 0; }
.prose sup a:hover, .prose .footnote-backref:hover { color: var(--bright); }

footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); color: var(--faint); font-size: 0.75rem; }
.home > footer { margin-top: 0; }
:focus-visible { outline: 2px solid var(--bright); outline-offset: 5px; }
::selection { background: #3d3d48; color: #fff; }

@media (max-width: 540px) {
  body { padding-inline: 1.5rem; }
  main { margin-top: 3.5rem; margin-bottom: 2rem; }
  .home { margin-top: 2.5rem; }
  .head { margin-bottom: 1.75rem; }
  .home > section { grid-template-columns: minmax(0, 1fr); gap: 1rem; padding-block: 1.5rem; }
  .home > .projects { padding-block: 1.25rem 1.75rem; }
  .project-list { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .proj:nth-child(n+2) { padding-top: 1.25rem; border-top: 1px solid var(--rule); }
  .now-art { width: 4rem; height: 4rem; }
  .now-toggle, .now-track, .social-links a { min-height: 2.75rem; }
  .now-links a { width: 2rem; height: 2rem; }
  .now-player { gap: 0.5rem; margin-top: 0; }
  .contact-btn { min-height: 2.75rem; }
  .social-links { gap: 0.25rem 1.75rem; }
  footer { margin-top: 2.5rem; }
  .modal-card { padding: 1.5rem; }
  .m-row { flex-wrap: wrap; gap: 0.25rem 1rem; }
  .home.music-pending > .now-playing[hidden] { min-height: 8.25rem; }
}

@media (min-width: 541px) and (max-height: 760px) {
  main, .home { margin-block: 2.5rem 2rem; }
  .head { margin-bottom: 2rem; }
  .home > section { padding-block: 1.25rem; }
}

@media (hover: hover) and (pointer: fine) {
  .now-art:hover { transform: translateY(-2px) rotate(-2deg) scale(1.025); }
  .now-links a:hover { transform: translateY(-2px); background: var(--panel); }
}

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