:root {
  --code-block-font-size: clamp(.8125rem, 1.2vw, .9375rem);
  --code-block-padding: 1.25rem clamp(1rem, 2vw, 1.75rem);
  color-scheme: light;
  --paper: #f9f9f6;
  --ink: #242b28;
  --muted: #68706a;
  --title-optical-offset: -4px;
  --portrait-overlap: .16; /* Bottom 16% of the 2:1 image extends into the project section. */
  --line: #dcded6;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-futura: Futura, 'Century Gothic', Avenir, sans-serif;
  --desk-background: #171411;
  --dreamengine-title-size: clamp(2.6rem, 6.7vw, 8rem);
  --font-serif: 'Iowan Old Style', 'Baskerville', 'Palatino Linotype', Georgia, serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --opus-body-muted: #625b61;
  --opus-rose: #b43460;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 30px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible { outline: 2px solid #91a773; outline-offset: 7px; }
button[hidden] { display: none; }
::selection { background: #dbe5cf; color: var(--ink); }
.wrap { width: min(1120px, calc(100% - 80px)); margin-inline: auto; }

/* The portrait rests across the straight section edge. */
.hero { position: relative; overflow-x: clip; }
.hero-inner { position: relative; min-height: clamp(360px, 31vw, 440px); display: flex; align-items: center; }
.hero-copy { position: relative; z-index: 4; width: 46%; }
h1 { margin: 0 0 18px; font-size: clamp(38px, 4.6vw, 64px); font-weight: 650; line-height: 1.1; letter-spacing: -.025em; }
.introduction { display: block; font-size: .42em; font-weight: 400; color: var(--muted); letter-spacing: -.025em; margin-bottom: 4px; }
.profile-name { position: relative; left: var(--title-optical-offset); }
.doing { position: relative; font-size: clamp(24px, 2.8vw, 36px); line-height: 1.3; letter-spacing: -.035em; margin: 0; white-space: nowrap; }
.vision { font: inherit; color: inherit; }
.hero-portrait { position: absolute; z-index: 3; width: 58%; height: auto; right: -2%; bottom: 0; transform: translateY(calc(100% * var(--portrait-overlap))); pointer-events: none; }

/* Both project rows take the height of the taller one in either orientation. */
.homepage {
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr 1fr;
}
.dreamengine-hero {
  /* At this height a centered cover crop shows 1200 original image pixels. */
  --photo-height-limit: calc(100cqw * 917 / 1200);
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: calc(max(42rem, 66.6667cqw) * var(--project-height-scale, 1));
  background: var(--desk-background);
  color: white;
  font-family: var(--font-futura);
  text-align: center;
}
.dreamengine-art {
  position: absolute;
  z-index: -1;
  inset-inline: 0;
  top: 0;
  width: 100%;
  height: min(100%, var(--photo-height-limit));
  object-fit: cover;
  opacity: .54;
}
/* End the fade at the photo edge. A full-height photo leaves zero room for it. */
.dreamengine-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset-inline: 0;
  top: min(100%, var(--photo-height-limit));
  height: clamp(0px, 100% - var(--photo-height-limit), var(--photo-height-limit) * .18);
  transform: translateY(-100%);
  background: linear-gradient(transparent, var(--desk-background));
  pointer-events: none;
}
.dreamengine-copy { width: 100%; padding: 3.25rem 5% calc(3.25rem + 2.6vw); font-size: clamp(1.125rem, 2.85vw, 3.5rem); line-height: 1.22; text-wrap: balance; }
.dreamengine-title { margin: 0 0 clamp(1.5rem, 3.4vw, 4rem); font-size: var(--dreamengine-title-size); line-height: 1.05; }
.dreamengine-copy p { margin: 0; }
.dreamengine-copy p + p { margin-top: .38em; }

/* Equal-width resource links wrap together on narrow project pages. */
.source-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; margin-top: 48px; font-size: clamp(18px, 3vw, 20px); }
.source-links :is(a, button) {
  inline-size: min(13.75em, 100%);
  padding: 12px 1.15em;
  line-height: 1.3;
  border-radius: 999px;
}
.source-links a:focus-visible { outline-offset: 4px; }

.opus-page, .opus-hero {
  background:
    url("../assets/images/opus-grain.png") repeat 0 0 / 210px,
    linear-gradient(155deg, #f5dfc9, #eedfe4 42%, #dad0e9);
  font-family: var(--font-serif);
}

/* Anchor the paint to the lettering, including when a title wraps. */
.opus-brush {
  position: relative;
  isolation: isolate;
  width: fit-content;
  max-width: 100%;
}
.opus-brush::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset-inline: 0;
  bottom: -.36em;
  height: 1.05em;
  background: url("../assets/images/opus-swoop.png") center / 100% 100% no-repeat;
  opacity: .64;
}

/* Full-bleed Opus project hero. */
.opus-hero { position: relative; isolation: isolate; display: grid; place-items: center; padding-block: 140px 96px; text-align: center; }
.opus-content { --opus-sentence-size: clamp(30px, 3.6vw, 60px); --opus-support-size: clamp(16px, 4vw, 24px); width: min(1400px, calc(100% - clamp(48px, 6.25vw, 80px))); }
.opus-title { margin: 0; font-size: var(--opus-sentence-size); font-weight: 400; line-height: 1.25; letter-spacing: -.035em; text-wrap: balance; }
.opus-portrait-copy { display: none; }
.opus-wordmark { display: inline-flex; align-items: center; gap: .08em; vertical-align: baseline; white-space: nowrap; }
.opus-name { position: relative; top: -.06em; font-family: var(--font-serif); font-size: 1.35em; font-weight: 400; letter-spacing: -.055em; }
.opus-brace { font-family: var(--font-mono); font-size: .95em; font-weight: 300; }
.opus-slogan { display: block; margin-inline: auto; font: inherit; letter-spacing: inherit; }
.opus-description { max-width: 1000px; margin: 68px auto 0; font-size: var(--opus-support-size); line-height: 1.25; letter-spacing: -.035em; color: var(--opus-body-muted); text-wrap: balance; }

/* One native link makes the whole homepage project section keyboard accessible. */
.project-section-link { position: absolute; z-index: 2; inset: 0; }
.project-section-link:focus-visible { outline: 3px solid currentColor; outline-offset: -12px; }
.opus-hero .project-section-link { color: var(--opus-rose); }

.site-footer {
  display: grid;
  grid-template-columns: repeat(3, max-content) minmax(0, 1fr);
  gap: 2.5rem clamp(3.25rem, 6vw, 5.5rem);
  padding-block: clamp(3rem, 6vw, 5rem) 1.5rem;
  font-size: 1rem;
  line-height: 1.9;
}
.site-footer h2 { margin: 0 0 .75rem; font-size: 1.25rem; font-weight: 600; letter-spacing: -.025em; line-height: 1.25; }
.site-footer ul { margin: 0; padding: 0; list-style: none; }
.site-footer a { display: inline-flex; align-items: center; gap: .5rem; vertical-align: top; max-width: 100%; overflow-wrap: anywhere; text-decoration: none; text-underline-offset: .2em; }
.site-footer a:is(:hover, :focus-visible) { text-decoration: underline; }
.site-footer svg { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.location-heading { display: flex; align-items: center; gap: .5rem; }
.site-footer .location-map { position: relative; display: block; overflow: hidden; isolation: isolate; border: 1px solid var(--line); border-radius: 1rem; }
.location-map img { display: block; width: 100%; height: auto; }
.location-map::before { content: ""; position: absolute; top: 50%; left: 50%; translate: -50% -50%; width: .75rem; height: .75rem; background: var(--ink); border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 4px rgb(36 43 40 / .14); }
.map-label { position: absolute; left: 50%; bottom: calc(50% + .8rem); translate: -50%; padding: .25rem .6rem; border-radius: .4rem; background: var(--ink); color: white; font-size: .875rem; font-weight: 600; line-height: 1.3; }
.footer-copyright { grid-column: 1 / -1; color: var(--muted); font-size: .8125rem; }
@media (orientation: landscape) and (width > 58rem) {
  :is(.opus-page, .dreamengine-page) .site-footer {
    grid-template-columns: repeat(4, auto);
    justify-content: center;
  }
}
@media (max-width: 58rem) {
  .site-footer { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 36rem) {
  .site-footer { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); column-gap: 1rem; }
  .site-footer > section:nth-of-type(n + 3) { grid-column: 1 / -1; }
}

/* Two natural-width word layers share a baseline while the inline button resizes. */
.verb-phrase { white-space: nowrap; }
.rotating-word { position: relative; display: inline-block; vertical-align: baseline; padding: 0; border: 0; border-radius: 2px; margin: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; overflow: visible; appearance: none; }
.rotating-word:disabled { cursor: default; }
.rotating-word-layer { display: inline-block; width: max-content; white-space: nowrap; }
.rotating-word-layer.is-outgoing { position: absolute; top: 0; left: 0; pointer-events: none; }
.rotating-letter { display: inline-block; }

/* Keep pause/resume available to keyboards without adding visual decoration. */
.motion-toggle:focus-visible { position: absolute; top: calc(100% + 10px); left: 0; width: auto; height: auto; margin: 0; clip: auto; overflow: visible; padding: 5px 10px; border: 1px solid var(--line); background: var(--paper); font-size: 12px; letter-spacing: 0; }
.skip-link { position: fixed; top: -80px; left: 20px; padding: 12px 20px; z-index: 10; background: var(--paper); }
.skip-link:focus { top: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Once the photo needs its own space, use the remaining height for the copy. */
@media (max-width: 42rem) {
  .dreamengine-hero { grid-template-rows: auto 1fr; }
  .dreamengine-art {
    position: static;
    height: var(--photo-height-limit);
  }
  .dreamengine-copy { padding: 1.5rem 3% 2.5rem; }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 48px); }
  .hero-inner { min-height: auto; flex-direction: column; align-items: flex-start; }
  .hero-copy { padding-top: 80px; width: 100%; }
  h1 { font-size: clamp(38px, 9vw, 54px); }
  .doing { font-size: 28px; white-space: normal; }
  /* Full viewport width and a 2:1 image make its height 50vw. */
  .hero-portrait { position: relative; width: calc(100% + 48px); right: auto; bottom: auto; transform: none; margin: 48px -24px calc(-50vw * var(--portrait-overlap)); }
}
@media (orientation: landscape) and (width > 42rem) {
  .dreamengine-hero { --project-height-scale: .8; }
}
@media (orientation: landscape) {
  .opus-description { font-size: clamp(24px, 2.4vw, 32px); }
}
@media (orientation: portrait) {
  .opus-hero { padding-block: clamp(100px, 10vw, 140px) clamp(84px, 8vw, 96px); }
  .opus-content { --opus-sentence-size: clamp(26px, 6.8vw, 38px); }
  .opus-wordmark { display: flex; width: fit-content; margin: 0 auto 16px; font-size: 1.8em; translate: var(--title-optical-offset); }
  .opus-landscape-copy { display: none; }
  .opus-portrait-copy { display: inline; }
  .opus-slogan { margin-top: calc(clamp(32px, 6vw, 48px) + clamp(0px, 96px - 20vw, 16px)); font-size: var(--opus-support-size); }
  .opus-description { margin-top: 1em; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
