/* Shared page layout. */
body .title-phrase {
  display:inline-block;
  max-inline-size:100%;
  vertical-align:top;
}
body {
  --base-size:9px;
  --page-width-max:calc(100 * var(--base-size));
  --content-width-max:calc(var(--page-width-max) - 4 * var(--base-size));
  --content-radius:calc(2 * var(--base-size));
  --profile-photo-radius:var(--base-size);
  --content-padding:var(--base-size);
  --content-fade:var(--base-size);
  --content-bottom-limit:435;
  --content-artwork-clearance:calc(max(min(var(--content-bottom-limit) * 1px,100% * var(--content-bottom-limit) / 980),100% * var(--content-bottom-limit) / 1670) - 24px);
  --chrome-side-padding:var(--base-size);
  --chrome-fade:var(--base-size);
  --scene-sky:#7dc3fd;
  --surface-opacity:75%;
  --header-content-gap:calc(3 * var(--base-size));
  --focus-color:var(--accent-primary);
  --focus-width:3px;
  --focus-padding:calc(2 * var(--base-size) / 3);
  --focus-radius:calc(2 * var(--base-size) / 3);
  --line:#d8dfe3;
  position:relative;
  background:#83c4fa;
  isolation:isolate;
  /* Clip transient artwork/wrap overflow without creating a scroll container. */
  overflow-x:clip;
  padding-bottom:var(--scene-clearance,0px);
  min-height:max(100vh,var(--wrap-page-height,0px));
  min-height:max(100dvh,var(--wrap-page-height,0px));
  display:flex;
  flex-direction:column;
}
body > .site-header,body > .site-footer {
  flex-shrink:0;
}
/* Portraits and enlarged photo dialog. */
body .profile-photo-layout {
  display:flow-root;
  margin-bottom:var(--base-size);
}
body .profile-photo-column {
  line-height:1.6;
}
body .profile-photo {
  display:block;
  border-radius:var(--profile-photo-radius);
  --focus-radius:calc(var(--profile-photo-radius) + var(--focus-padding));
  cursor:zoom-in;
}
body .profile-photo > img {
  width:100%;
  height:auto;
  border-radius:inherit;
}
html.photo-overlay-open {
  overflow:hidden;
  scrollbar-gutter:stable;
  background:#20313f;
}
body .photo-dialog {
  width:fit-content;
  max-width:calc(100% - 2rem);
  max-height:calc(100% - 2rem);
  margin:auto;
  padding:3rem 0 0;
  border:0;
  overflow:visible;
  color:#fff;
  background:transparent;
}
body .photo-dialog::backdrop {
  background:rgb(0 0 0 / .75);
}
body dialog.photo-dialog .photo-dialog-close {
  position:absolute;
  top:0;
  right:0;
  z-index:1;
  gap:.5rem;
  min-width:var(--control-min-size);
  color:inherit;
  background:transparent;
  text-shadow:0 1px 3px rgb(0 0 0 / .8);
  white-space:nowrap;
  --focus-color:#fff;
}
body .photo-dialog-close > span {
  font-size:var(--font-heading);
  line-height:1;
}
body .photo-dialog > img {
  width:auto;
  height:auto;
  max-height:calc(100vh - 5rem);
  max-height:calc(100dvh - 5rem);
  border-radius:var(--profile-photo-radius);
}
/* Contact dialog. */
body .contact-panel {
  min-height:0;
}
html:has(.contact-dialog[open]) {
  overflow:hidden;
}
body .contact-dialog {
  width:min(38rem,calc(100% - 2rem));
  max-height:calc(100vh - 2rem);
  max-height:calc(100dvh - 2rem);
  margin:auto;
  padding:var(--base-size);
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scrollbar-color:#79716b transparent;
  border:1px solid var(--line);
  border-radius:var(--content-radius);
  color:inherit;
  background:var(--paper);
  box-shadow:0 .75rem 2.5rem rgb(0 0 0 / .25);
}
body .contact-dialog[open] {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:start;
  gap:var(--base-size);
}
body .contact-dialog::backdrop {
  background:rgb(0 0 0 / .6);
}
body .contact-dialog .contact-dialog-close {
  grid-column:2;
  grid-row:1;
  position:sticky;
  inset-block-start:0;
  z-index:2;
  background:var(--paper);
}
body .contact-dialog .contact-intro {
  grid-column:1;
  grid-row:1;
  align-self:center;
  margin:0;
}
body .contact-dialog .contact-intro h2 {
  margin:0;
}
body .contact-dialog .contact-panel {
  grid-column:1 / -1;
}
body .contact-dialog .contact-form-actions {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:var(--base-size);
}
body .contact-dialog .form-intro {
  margin-block:0;
}
body .profile-body h2 {
  font-size:var(--font-xlarge);
  line-height:1.3;
  letter-spacing:normal;
}
/* The homepage composition is shared by every route, independent of page length. */
.site-scene {
  position:absolute;
  inset:0;
  overflow:hidden;
  pointer-events:none;
}
.site-scene::before {
  content:'';
  position:absolute;
  inset:0;
  z-index:-1;
  background:var(--scene-sky);
}
/* Scale the scene together, with a closer crop on narrow screens. */
.scene-canvas {
  position:absolute;
  bottom:0;
  right:0;
  width:max(100%,min(1670px,calc(100% * 1670 / 980)));
  aspect-ratio:1670 / 940;
}
.scene-background {
  position:absolute;
  inset:0;
  z-index:-1;
  width:100%;
  height:100%;
  /* Let the shared sky color replace the first row of the 900px-tall image. */
  clip-path:inset(calc(100% / 900) 0 0);
}
.scene-character {
  position:absolute;
  z-index:1;
  right:0;
  bottom:var(--footer-height,28px);
  width:29.3413%;
}
.scene-character > img {
  width:100%;
}
/* Header, content, and footer. */
body > header.site-header {
  position:absolute;
  inset:0 0 auto;
  width:100%;
  isolation:isolate;
  z-index:10;
}
body > .site-header .header-inner {
  width:100%;
  max-width:var(--page-width-max);
  padding:0 var(--chrome-side-padding);
}
body > main {
  position:relative;
  isolation:isolate;
  flex:0 0 auto;
  width:calc(100% - 4 * var(--base-size));
  max-width:var(--content-width-max);
  margin:calc(var(--header-height,calc(2.75rem + 32px)) + var(--header-content-gap)) auto calc(2 * var(--base-size) + var(--content-artwork-clearance));
  padding:var(--content-padding);
  border-radius:var(--content-radius);
}
body .contact-intro {
  margin-bottom:var(--base-size);
}

body > .site-footer {
  position:absolute;
  bottom:0;
  left:0;
  right:0;
  min-height:28px;
  width:100%;
  isolation:isolate;
  z-index:10;
}
body > main .container {
  width:100%;
  margin-left:0;
  margin-right:0;
}
/* Plain text over the shared translucent backgrounds. */
#main, #main :is(p,h1,h2,h3) {
  color:#000;
}
body > main .page-lead {
  font-weight:500;
}
.text-wrap {
  display:none;
}
@media(width < 320px) {
  body > main {
    /* Reserve the full character height at the narrow scene scale. */
    margin-bottom:calc(var(--footer-height,28px) + var(--character-height,0px) + 2 * var(--base-size));
  }
}
body:not(.home-page,.has-character-wrap) > main {
  z-index:2;
}
/* Wrap text around the character from 320px upward. */
@media(min-width:320px) {
  body > main {
    display:flow-root;
  }
  .text-wrap {
    display:block;
    float:right;
    pointer-events:none;
    margin-left:var(--base-size);
  }
}
body > .site-footer .footer-bottom {
  width:100%;
  max-width:var(--page-width-max);
  min-height:28px;
  padding:0 var(--base-size);
  justify-content:center;
  text-align:center;
  color:#000;
}
/* Full-width header/footer backgrounds and the content's outside fade. */
body > header.site-header::before, body > main::before, body > .site-footer::before, .home-page .welcome-content::before {
  content:"";
  position:absolute;
  inset:0;
  z-index:-1;
  background:rgb(255 255 255 / var(--surface-opacity));
  pointer-events:none;
}
body > header.site-header::before {
  bottom:calc(-1 * var(--chrome-fade));
  mask-image:linear-gradient(to bottom,#000 calc(100% - var(--chrome-fade)),transparent);
}
body > .site-footer::before {
  top:calc(-1 * var(--chrome-fade));
  mask-image:linear-gradient(to top,#000 calc(100% - var(--chrome-fade)),transparent);
}
body > main::before, .home-page .welcome-content::before {
  inset:calc(-.5 * var(--content-fade));
  border-radius:calc(var(--content-radius) + .5 * var(--content-fade));
  filter:blur(calc(var(--content-fade) / 4));
}
body .share-status { margin-inline-start:var(--base-size); }
body #share-link-fallback { margin-block:var(--base-size); }
body #share-link-fallback label { display:block; }
body #share-link { width:100%; }

/* Shared vertical rhythm for content on every page. Keep spacing on the
   preceding block so nested sections do not accumulate extra padding. */
body #main :is(section,.profile-body,.connect-actions,.contact-intro) {
  margin-block:0 var(--base-size);
  padding-block:0;
}
body #main :is(h1,h2,h3,p) {
  margin-block:0 var(--base-size);
}
body #main .button {
  margin-bottom:var(--base-size);
  column-gap:var(--base-size);
}
body #main :is(section,.profile-body,.connect-actions,.contact-intro,h1,h2,h3,p,.button):last-child {
  margin-bottom:0;
}
body #main .submit-button {
  margin-bottom:0;
}

/* Header and footer share the content's spacing unit at every breakpoint. */
body > .site-header :is(.header-inner,.brand),
body > .site-footer .footer-bottom {
  gap:var(--base-size);
}
body > .site-header .brand {
  font-size:var(--font-xlarge);
}
@media(max-width:40em) {
  body > .site-header .header-inner {
    flex-wrap:nowrap;
  }
}

/* Homepage layout. */
body.home-page {
  --page-gutter:calc(2 * var(--base-size));
  --page-shell:56.25rem;
  --welcome-panel-padding:var(--base-size);
  padding-bottom:0;
  background:var(--paper);
}

body.home-page > header.site-header {
  position:sticky;
  background:var(--paper);
  border-bottom:1px solid #000;
}
body.home-page > .site-header .header-inner,
.home-content {
  width:min(var(--page-shell),calc(100% - 2 * var(--page-gutter)));
  padding-inline:var(--welcome-panel-padding);
}
body.home-page > .site-header .header-inner {
  min-height:2.75rem;
  padding-block:.45rem;
}
body.home-page > .site-header .brand {
  white-space:normal;
}
body.home-page > header.site-header::before,
body.home-page > main::before,
body.home-page > .site-footer::before {
  display:none;
}

body.home-page > main {
  container-type:inline-size;
  flex:1 0 auto;
  width:100%;
  max-width:none;
  margin:0;
  padding:0;
  border-radius:0;
}
body.home-page #main :is(h1,h2,h3,p) {
  color:var(--accent-secondary);
}

body.home-page #main .welcome-scene {
  --welcome-canvas:clamp(29rem,155vw,64rem);
  /* Size the character from its 490 × 600 image and the scene scale. */
  --welcome-character-width:min(calc(var(--welcome-canvas) * 490 / 1670),max(28rem,25.5vw));
  --welcome-character-height:calc(var(--welcome-character-width) * 600 / 490);
  --character-lift:var(--base-size);
  --welcome-top-padding:18px;
  /* Scale the bottom limit in the artwork's 1670 × 940 reference space. */
  --welcome-clearance:max(0px,calc(var(--welcome-canvas) * var(--content-bottom-limit) / 1670));
  position:relative;
  display:grid;
  grid-template-columns:minmax(0,var(--page-shell));
  align-items:start;
  justify-content:center;
  min-block-size:max(calc(var(--welcome-top-padding) + var(--welcome-character-height) + var(--character-lift)),var(--wrap-page-height,0px));
  isolation:isolate;
  margin:0;
  padding:var(--welcome-top-padding) var(--page-gutter) var(--welcome-clearance);
  background:var(--scene-sky);
}
@media (prefers-reduced-motion:no-preference) {
  @supports (animation-timeline:view()) and (animation-range:exit-crossing) {
    .home-page .welcome-scene {
      view-timeline:--welcome-exit block;
      view-timeline-inset:var(--header-height,2.75rem) 0px;
      overflow:clip;
    }
    .home-page .welcome-scene :is(.site-scene,.scene-foreground) {
      animation:pin-welcome-artwork linear both;
      animation-timeline:--welcome-exit;
      animation-range:exit-crossing 0% exit-crossing 100%;
    }
    .home-page .welcome-content {
      animation:fade-welcome-panel linear both;
      animation-timeline:--welcome-exit;
      animation-range:exit-crossing 0% exit-crossing 100%;
    }
    body.home-page {
      --welcome-overlap:clamp(36px,8vw,72px);
      timeline-scope:--welcome-exit;
    }
    .home-content {
      margin-block-end:calc(-1 * var(--welcome-overlap));
      animation:close-welcome-gap linear both;
      animation-timeline:--welcome-exit;
      animation-range:exit-crossing 0% exit-crossing 100%;
    }
    body.home-page > .site-footer {
      animation:follow-home-content linear both;
      animation-timeline:--welcome-exit;
      animation-range:exit-crossing 0% exit-crossing 100%;
    }
  }
}
@keyframes close-welcome-gap {
  from { translate:0 0; }
  to { translate:0 calc(-1 * var(--welcome-overlap)); }
}
@keyframes follow-home-content {
  from { translate:0 var(--welcome-overlap); }
  to { translate:0 0; }
}
@keyframes pin-welcome-artwork {
  from { translate:0 0; }
  to { translate:0 100%; }
}
@keyframes fade-welcome-panel {
  from { translate:0 0; opacity:1; }
  50% { translate:0 calc(var(--welcome-height,0px) / 2); opacity:0; }
  to { translate:0 var(--welcome-height,0px); opacity:0; }
}
.home-page .welcome-scene .scene-canvas {
  width:var(--welcome-canvas);
}
.welcome-scene .scene-foreground {
  position:absolute;
  inset:0;
  z-index:3;
  pointer-events:none;
}
.home-page .welcome-scene .scene-character {
  bottom:var(--character-lift);
  width:var(--welcome-character-width);
}
.home-page .welcome-content {
  position:relative;
  justify-self:start;
  max-inline-size:100%;
  isolation:isolate;
  padding:var(--welcome-panel-padding);
  /* Keep the foreground character below the text as it overlaps the panel. */
  padding-block-end:max(var(--welcome-panel-padding),calc(var(--welcome-character-height) + var(--character-lift) - var(--welcome-clearance)));
  border-radius:var(--content-radius);
}
.home-page .welcome-scene:not(.has-character-wrap) .welcome-content {
  z-index:2;
}
@media (min-width:320px) {
  .home-page .welcome-scene.has-character-wrap .welcome-content {
    padding-block-end:var(--welcome-panel-padding);
  }
}
@media (width < 320px) {
  body.home-page #main .welcome-scene {
    --welcome-clearance:calc(var(--welcome-character-height) + var(--character-lift) + var(--base-size));
  }
}
body.home-page #main .welcome-content h1 {
  margin-bottom:clamp(.625rem,1.3vw,1rem);
}
.home-page .welcome-content .title-phrase {
  display:block;
  text-wrap:balance;
}
body.home-page #main .page-section p {
  margin-bottom:var(--base-size);
  line-height:1.6;
}
body.home-page #main .welcome-intro p {
  margin-bottom:.625em;
  line-height:1.5;
}
body.home-page #main .welcome-intro p:last-child {
  margin-bottom:0;
}
.home-content {
  position:relative;
  isolation:isolate;
  margin-inline:auto;
  padding-block-start:calc(2 * var(--base-size));
}
.home-content::before {
  content:'';
  position:absolute;
  inset-block:0;
  inset-inline-start:50%;
  inline-size:100cqw;
  transform:translateX(-50%);
  background:var(--paper);
  border-block-start:1px solid #000;
  z-index:-1;
}
body.home-page #main .page-section {
  position:relative;
  margin:0;
  padding-block:0;
}
body.home-page #main .page-section:first-child {
  padding-block-start:var(--base-size);
}
body.home-page #main .page-section h2 {
  margin-bottom:var(--base-size);
}
body.home-page #main #profile-heading {
  font-size:var(--font-display);
  line-height:1.12;
  letter-spacing:-1px;
}
body.home-page #main .page-section h3 {
  margin-bottom:calc(var(--base-size) / 3);
  font-family:var(--font-secondary);
  font-size:var(--font-xlarge);
  line-height:1.3;
}
body.home-page #main .profile-photo-column {
  width:100%;
  margin:0 auto clamp(1rem,3vw,1.75rem);
}
body.home-page #main .profile-photo {
  border:1px solid #000;
  border-radius:.9rem;
  box-shadow:0 .6rem 1.55rem rgb(37 57 73 / 15%);
}
body.home-page #main .connect-section {
  margin:0 0 calc(var(--base-size) / 3);
  padding:clamp(1rem,2vw,1.5rem);
  border:1px solid rgb(37 57 73 / 16%);
  border-radius:clamp(1rem,2vw,1.5rem);
  background:#e9eff0;
  text-align:center;
}
body.home-page #main .connect-section p {
  margin-bottom:.5rem;
}
body.home-page #main .connect-actions {
  display:flex;
  justify-content:center;
  align-items:center;
  flex-wrap:wrap;
  gap:.75rem;
  margin:var(--base-size) auto 0;
}
body.home-page #main .connect-actions .button {
  margin:0;
}
.home-page .share-status:empty {
  display:none;
}
.home-page #share-link-fallback {
  flex-basis:100%;
}
body.home-page > .site-footer {
  position:static;
  padding:.8rem var(--page-gutter);
  border-top:1px solid rgb(37 57 73 / 15%);
}
body.home-page > .site-footer .footer-bottom {
  color:var(--accent-secondary);
}

@media (min-width:375px) {
  body.home-page #main .profile-photo-column {
    --photo-gap:9px;
    float:left;
    width:fit-content;
    max-width:50%;
    margin:0 var(--photo-gap) .75rem 0;
  }
  body.home-page #main .profile-photo-layout--right .profile-photo-column {
    float:right;
    margin:0 0 .75rem var(--photo-gap);
  }
  body .profile-photo > img {
    width:auto;
    max-height:11lh;
  }
}

@media (min-width:48em), (min-width:38em) and (orientation:landscape) {
  body.home-page #main .welcome-scene {
    --welcome-canvas:max(100cqw,46rem);
  }
}

@media (max-width:40em) {
  body.home-page > .site-header .header-inner {
    display:flex;
    flex-wrap:wrap;
    padding-block:.35rem;
  }
}
